SQL - Move nulls to end of ORDER BY clause


/ Published in: SQL
Save to your folder(s)



Copy this code and paste it in your HTML
  1. SELECT custid, region
  2. FROM [Sales].[Customers]
  3. ORDER BY
  4. CASE WHEN region IS NULL THEN 1 ELSE 0 END, region;

Report this snippet


Comments


You need to login to view comments.