Subject Case sql
Author Stef
Good day everybody,



I have the following query



____________________________________________________________________________
____________________



select

D.NAME as NAME,

(case (extract (Weekday from P.plandate )) when 1 then (P.PLANSTATUS)
else '' end) as Monday,

(case (extract (Weekday from P.plandate )) when 2 then (P.PLANSTATUS)
else '' end) as Tuesday,

(case (extract (Weekday from P.plandate )) when 3 then (P.PLANSTATUS)
else '' end) as Wednesday,

(case (extract (Weekday from P.plandate )) when 4 then (P.PLANSTATUS)
else '' end) as Thursday,

(case (extract (Weekday from P.plandate )) when 5 then (P.PLANSTATUS)
else '' end) as Friday,

(case (extract (Weekday from P.plandate )) when 6 then (P.PLANSTATUS)
else '' end) as Saturday,

(case (extract (weekday from P.plandate )) when 0 then (P.PLANSTATUS)
else '' end) as Sunday

from driverplan P



join DRIVERS D on P.DRIVERNR = D.DRIVERNR



where P.plandate >= '2017/01/01'



order by 1



____________________________________________________________________________
____________________



My question is why does it not return 1 row per driver, but instead I get 7
rows?



Else how can I achieve this?



Regards



Stef van der Merwe



Email stef@...







[Non-text portions of this message have been removed]