How to order by column with non-null values first in sql

后端 未结 3 1229
名媛妹妹
名媛妹妹 2020-12-31 03:48

I need to write a sql statement to select all users ordered by lastname, firstname. This is the part I know how to do :) What I don\'t know how to do is to order by non-nu

3条回答
  •  误落风尘
    2020-12-31 04:15

    Nowadays the
    IIF ( boolean_expression, true_value, false_value )

    will suit too.

    ORDER BY IIF(name IS NULL, 1, 0), name

提交回复
热议问题