Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Define time periode based on hour

$
0
0
Why can I not use the Timep in my CASE:confused:?

select weekday(callstart) as weekday, week_of_year(callstart)+1 AS Ugenr, TO_CHAR(callstart , '%A %B %d, %Y %R'), callstart::datetime hour to hour AS Timep, callstart,
'Timeperiode' = case
when Timep >= 0 and Timep < 10 then 0
when Timep >= 10 and Timep < 16 then 1
when Timep >= 16 and Timep < 22 then 2
else 0
end
from callrecord where callstart > "2012-10-19 00:00:00.000" and callstart < "2012-11-26 00:00:00.000";

Viewing all articles
Browse latest Browse all 13329

Trending Articles