where clause in select statement

homer.favenir

Verified User
Joined
Feb 19, 2008
Messages
12
Location
manila, philippines
hi to all,
can anyone please tell me how to separate 1 field and make it to 2 fields.
i have break_hours field, and time_end field.
i need to compute the sum of break_hours if time_end <= '16:00', for field1,
and i need to compute the sum of break_hours if time_end > '16:00' for field2,
so i have 2 fields from 1 field.
Code:
select
`Date`,
last_name,
(sum(break_hours) where time_end <= '16:00') as 'field1',
(sum(break_hours) where time_end > '16:00') as 'field2'

FROM
coding_log

Group By
`Date`,
Last_Name
is this correct? cause it doesnt work.
please advice.

thanks
:(
 
Back
Top