Eirikur Eiriksson wrote:Just add your logic to a character column using 0 and 1 😉
😎
i can add my logic to char, date time and bit columns, all at the same time:
ORDER BY CASE
WHEN Invoice.Status = ‘Overdue’ THEN 0
WHEN Invoice.DueDate > GETDATE() THEN 10
WHEN ACCOUNT.IsActive = 0 then 30
WHEN ....
ELSE 99 END, ...
Should add binary?
Sorting by the numbers in the end. What’s used for the conditions does not matter at all.