I have a query that looks something like this:
SELECT weekEnd, MAX(timeMonday)
FROM timesheet
GROUP BY weekEnd
Valid values ββfor timeMonday are: null, -1, 0, 1-24. At the moment, MAX () puts the preference of these values ββin null, -1, 0, 1-24 order, however what I really want is -1, null, 0, 1-24, so the null value is considered higher than -1. I know that MAX cannot do this, and what is the easiest way to achieve this?
source
share