1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| SELECT
T_final.N°Sortie ,
T_final.[Nom Porte principale] ,
T_final.Destination ,
T_final.Type,
T_final.NbColis
FROM (
SELECT
T_Chute.N°Sortie,
IIf([N°Sortie]=0,"A REBASCULER",[T_Chute].[Destination]) AS Destination,
IIf([N°Sortie]=0,"Rejet Technique",[T_Chute].[Nom Porte principale]) AS [Nom Porte principale],
IIf([N°Sortie]=0,"RJT",[T_Chute].[Type]) AS Type
FROM T_Chute
union
SELECT
dbo_Parcel.N°chute,
dbo_ParcelEvent.DateTime,
Count(dbo_ParcelEvent.IdParcel) AS nbColis
FROM dbo_Parcel INNER JOIN dbo_ParcelEvent ON dbo_Parcel.Id = dbo_ParcelEvent.IdParcel
GROUP BY dbo_Parcel.N°chute,
dbo_ParcelEvent.DateTime
Where ( T_Chute.N°Sortie=dbo_Parcel.N°chute)
) AS T_final
GROUP BY
T_final.N°Sortie,
T_final.[Nom Porte principale],
T_final.Destination,
T_final.Type,
T_final.NbColis; |
Partager