有人能解释一下这个sql查询是如何工作的吗.按部分排序



**问题--为每个客户返回客户ID和地区--按区域对输出中的行进行排序--NULL排序在最后(非NULL值之后(

select custid
, region
from sales.Customers
order 
by case when region is null then 1 else 0 end
, region

将查询更改为:

select custid
, region
, case when region is null then 1 else 0 end sorter
from sales.Customers

现在你能看到它在做什么吗?

最新更新