Hi
I am trying to get 12 hour shift from my Date Time column but no lucky. can anyone please help me in this.
Recorded Date/Time is the column name. I need to get 12 hour shift our of that column which is everyday morning 7am to 7pm(12 hours)
thanks,
Not sure if I am missing something in your requirement but this looks pretty straight to me. You can try writing a case statement that will look like the below (excuse syntax errors please).
case when extract(recorded_date,HH) between 7 and 19 then 'Day Shift'
else 'Night Shift' end
Thank you very much Charlie, logic worked perfectly..