SQL for sorting boolean column as true, null, false August 5, 2023 by Tarik Not beautiful, but should work: ... order by (case when f1 then 1 when f1 is null then 2 else 3 end) asc