I use case statements all the time in TSQL.
But my new job is working with PL/SQL SQL+.
I can not figure out how to do this in PL/SQL SQL+.
HELP
Example: (Tale in sql server)
TimecardTbl
Empid period hours
100 1 40
200 1 35
100 2 20
200 2 10
(my Tsql statement)
select empid,
P1Hrs = case when period = ‘1’ then sum(hours)
Else 0
End
P2Hrs = case when period = ‘2’ then sum(hours)
Else 0
End
from timecardtbl
group by empid, period
Results:
Empid P1Hrs P2Hrs
100 40 20
200 35 10
Please help
But my new job is working with PL/SQL SQL+.
I can not figure out how to do this in PL/SQL SQL+.
HELP
Example: (Tale in sql server)
TimecardTbl
Empid period hours
100 1 40
200 1 35
100 2 20
200 2 10
(my Tsql statement)
select empid,
P1Hrs = case when period = ‘1’ then sum(hours)
Else 0
End
P2Hrs = case when period = ‘2’ then sum(hours)
Else 0
End
from timecardtbl
group by empid, period
Results:
Empid P1Hrs P2Hrs
100 40 20
200 35 10
Please help