Bonjour,
J'ai créé une requête SQL qui ne fonctionne malheureusement pas.
je penses que je l'ai mal écrite..
Y aurait il une âme charitable qui pourrait m'aider à reconstruire ma requête sql
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
41
42
43
44
45
46
47 DECLARE @EVENT_TYPE_SORTING Int = 2 -- Tri DECLARE @EVENT_TYPE_REJECT Int = 34 -- Rejet DECLARE @StartDateTime DateTime = '20180613 04:30:00' DECLARE @EndDateTime DateTime = '20180614 13:30:00' SELECT Parcel.[Id] as id, Tache.Num as TacheTri, Chute.Num as num, dsc.SortingType as type, IDT13.[Barcode] as Cab_Suivi, IDT24.[Barcode] as Cab_Pch, IDT28.[Barcode] as Cab_Geolabel, Parcel.[PostalCodeAcqMode] as Acquisition_PostalCode, FROM [Chute] Left outer join (Vacation JOIN Parcel ON (Vacation.Debut BETWEEN @StartDateTime AND @EndDateTime OR Vacation.Fin BETWEEN @StartDateTime AND @EndDateTime) AND Vacation.Id=Parcel.VacationId JOIN ParcelEvent ON Parcel.Id=ParcelEvent.ParcelId AND ParcelEvent.EventTypeNum IN (@EVENT_TYPE_SORTING,@EVENT_TYPE_REJECT) AND ParcelEvent.[DateTime] BETWEEN @StartDateTime AND @EndDateTime Left outer join [Barcode] as IDT13 with(nolock) on IDT13.[ParcelId] = Parcel.[Id] and len(IDT13.[Barcode])='13' Left outer join [Barcode] as IDT24 with(nolock) on IDT24.[ParcelId] = Parcel.[Id] and len(IDT24.[Barcode])='24' Left outer join [Barcode] as IDT28 with(nolock) on IDT28.[ParcelId] = Parcel.[Id] and len(IDT28.[Barcode])='28') ON Chute.Num =Parcel.PhysicalChuteNum left join dsc on dsc.chute=chute.num and dsc.Idtache=Vacation.idtache join tache on tache.id= dsc.IdTache
Partager