Ordering with NULL

  • Just add your logic to a character column using 0 and 1 😉

    😎

     

  • 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.

    _____________
    Code for TallyGenerator

Viewing 2 posts - 16 through 17 (of 17 total)

You must be logged in to reply to this topic. Login to reply