1 2 3
| SELECT dbo_Carb_Mvt_ST5_ST6.Code_Site, dbo_Carb_Mvt_ST5_ST6.Date_Mvt, dbo_ENGIN_VUE.CodeEngin, dbo_Carb_Mvt_ST5_ST6.Type_Perception, dbo_Carb_Mvt_ST5_ST6.Origine_Carb, dbo_Carb_Mvt_ST5_ST6.Type_Carb, dbo_Carb_Mvt_ST5_ST6.Volume_Carb, dbo_Carb_Mvt_ST5_ST6.Potentiel_Kmjour, IIf(DLast("Date_Mvt","dbo_Carb_Mvt_ST5_ST6","[Codeident]=" & [Codeident] & " And [Date_Mvt] < " & Format([Date_Mvt],"\#mm\/dd\/yyyy\#"))<=[chgt_comptKM] And [Date_Mvt]>=[chgt_comptKM],"chgt compteur",DLast("Potentiel_Kmjour","dbo_Carb_Mvt_ST5_ST6","[Codeident]=" & [Codeident] & " And [Date_Mvt] < " & Format([Date_Mvt],"\#mm\/dd\/yyyy\#"))) AS Ancien_Potentiel_Km, IIf([Ancien_Potentiel_Km]="chgt compteur",0,[Potentiel_Kmjour]-[Ancien_Potentiel_Km]) AS parcouru, IIf([parcouru]>0,([dbo_Carb_Mvt_ST5_ST6]![Volume_Carb]*100)/[parcouru],0) AS Conso_au_100km, dbo_Carb_Mvt_ST5_ST6.Potentiel_Hjour, IIf(DLast("Date_Mvt","dbo_Carb_Mvt_ST5_ST6","[Codeident]=" & [Codeident] & " And [Date_Mvt] < " & Format([Date_Mvt],"\#mm\/dd\/yyyy\#"))<=[chgt_comptHM] And [Date_Mvt]>=[chgt_comptHM],"chgt compteur",DLast("Potentiel_Hjour","dbo_Carb_Mvt_ST5_ST6","[Codeident]=" & [Codeident] & " And [Date_Mvt] < " & Format([Date_Mvt],"\#mm\/dd\/yyyy\#"))) AS Ancien_Potentiel_moteur, IIf([Ancien_Potentiel_moteur]="chgt compteur",0,[Potentiel_Hjour]-[Ancien_Potentiel_moteur]) AS Nb_heures_moteur, IIf([Nb_heures_moteur]>0,([dbo_Carb_Mvt_ST5_ST6]![Volume_Carb]*1)/[Nb_heures_moteur],0) AS Conso_litre_heure_mot, dbo_Carb_Mvt_ST5_ST6.Potentiel_Hequipement, IIf(DLast("Date_Mvt","dbo_Carb_Mvt_ST5_ST6","[Codeident]=" & [Codeident] & " And [Date_Mvt] < " & Format([Date_Mvt],"\#mm\/dd\/yyyy\#"))<=[chgt_comptHE] And [Date_Mvt]>=[chgt_comptHE],"chgt compteur",DLast("Potentiel_Hequipement","dbo_Carb_Mvt_ST5_ST6","[Codeident]=" & [Codeident] & " And [Date_Mvt] < " & Format([Date_Mvt],"\#mm\/dd\/yyyy\#"))) AS Ancien_Potentiel_equipement, IIf([Nb_heures_equipement]>0,([dbo_Carb_Mvt_ST5_ST6]![Volume_Carb]*1)/[Nb_heures_equipement],0) AS Conso_litre_heure_equi, IIf([Ancien_Potentiel_equipement]="chgt compteur",0,[Potentiel_Hequipement]-[Ancien_Potentiel_equipement]) AS Nb_heures_equipement, dbo_Carb_Mvt_ST5_ST6.Commentaires, Format([date_chgt_ComptKM],"dd/mm/yyyy") AS chgt_comptKM, Format([date_chgt_ComptHM],"dd/mm/yyyy") AS chgt_comptHM, Format([date_chgt_ComptHE],"dd/mm/yyyy") AS chgt_comptHE, dbo_Carb_Mvt_ST5_ST6.Codeident, Month([Date_Mvt]) AS mois_d, Year([Date_Mvt]) AS Expr1
FROM (dbo_Carb_Mvt_ST5_ST6 LEFT JOIN dbo_ENGIN_VUE ON dbo_Carb_Mvt_ST5_ST6.Codeident = dbo_ENGIN_VUE.CodeIdentite) LEFT JOIN Req_chgt_compt_2011 ON dbo_ENGIN_VUE.CodeEngin = Req_chgt_compt_2011.CodeEngin
WHERE (((Year([Date_Mvt]))=IIf(Month(Now())=1,Year(Now())-1,Year(Now())))); |
Partager