I have written the below query to take the hours based on conditions:
select h.device_id,
h.month_id,
h.group,
h.hours,
t.class
from dbo.network_hours h,
dbo.monthly_class t
where h.device_id = t.device_id
and h.month_id = t.month_id
and
case when h.group IN ('Adult','Zone','Family','Latino','Comedy','West')
then h.hours >= 0.13333
end h.hours >= 0.08333;
So the objective is :
There are a few classes whose hours I need to take if that value is >= 8mins(0.133 hrs) and for other classes which do not fall in the group
the hours have to be >= 5min(0.0833 hrs). I have tried the above using CASE but not sure. There is no error as such but how do I make sure I am getting the
correct values.
Can someone please help me with this?
Wouldn't that be
where h.hours >=
case when h.group in ('Adult','Zone','Family','Latino','Comedy','West') then 0.13333
else 0.08333
end