I have the following SQL Query:
SELECT IIF(clock_to - clock_at_from < 0,
12 - (clock_at_from - clock_to),
clock_to - clock_at_from) AS clock_pos
FROM Condition
Which outputs numbers from 1-10
I think I want to preform a CASE statement on clock_pos where
If clock_pos = 1 value = 3
If clock_pos = 2 value = 4
If clock_pos > 3 value = 5
To then add the final result back as a new column in the Conditions table...
Yet I'm unsure how to write this using the result named clock_pos or if there is a better way altogether.
@EDIT as per TONY Nested If attempt. I was unable to make an additional If statment
SELECT IIF(clock_to - clock_at_from < 0,
IIF(12 - (clock_at_from - clock_to) >= 3, 5, 12 - (clock_at_from - clock_to)),
clock_to - clock_at_from) as clock_pos
FROM Conditions