Skip to content
Advertisement

Case statement based on the time

I have the following table

enter image description here

Based on the transaction_DT: if the transaction between 04:00:00 PM to 08:00:00 AM + next day get “After Hour”

Between 08:00:00 AM to 04:00:00 PM within same day get “Working Hour”

Using the case statement it is not works!

Advertisement

Answer

Hmmm . . . how about something like this:

Your code doesn’t work because you are comparing a value with a time component only (well a default date component) to one with a date component.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement