Vote count:
0
I have this situation here in SQL where i need to display dr_DRVNUM, DR_DRVNAME & number of days worked for drivers who have worked the same shift on multiple days.
any help will be appreciated
I HAVE THIS CODE in SQL i also try different code so far but still not any luck
select dr_drvname, dr_drvnum, sh_wkdate
case when sh_drvnum = dr_drvnum and sh_wkshift = 'DAY' then count(sh_wkdate) end
from driver, shift
I have a table I am uploading a part of the table image below,
DR_DRVNUM" "DR_DRVNAME" "SH_WKDATE" "SH_WKSHIFT"
"0001" "Cooper, Randolph B." "15-NOV-07" "DAY"
0001 Cooper, Randolph B. 15-NOV-07 DAY
0001 Cooper, Randolph B. 15-NOV-07 DAY
0001 Cooper, Randolph B. 15-NOV-07 EVE
0001 Cooper, Randolph B. 15-NOV-07 EVE
0001 Cooper, Randolph B. 15-NOV-07 EVE
0001 Cooper, Randolph B. 15-NOV-07 NIG
0001 Cooper, Randolph B. 15-NOV-07 NIG
0001 Cooper, Randolph B. 15-NOV-07 NIG
0001 Cooper, Randolph B. 16-NOV-07 DAY
0001 Cooper, Randolph B. 16-NOV-07 DAY
0001 Cooper, Randolph B. 16-NOV-07 DAY
0001 Cooper, Randolph B. 16-NOV-07 DAY
0001 Cooper, Randolph B. 16-NOV-07 DAY
0001 Cooper, Randolph B. 16-NOV-07 DAY
0001 Cooper, Randolph B. 16-NOV-07 DAY
0001 Cooper, Randolph B. 16-NOV-07 EVE
0001 Cooper, Randolph B. 16-NOV-07 EVE
How to use case statment in SQL
Aucun commentaire:
Enregistrer un commentaire