Oracle使用order by排序關於null值處理


select * from dual order by age desc nulls last

 

select * from test order by age asc nulls first

 

sqlserver 認為 null 最小。 


升序排列:null 值默認排在最前。 


要想排后面,則:order by case when col is null then 1 else 0 end ,col 


降序排列:null 值默認排在最后。 


要想排在前面,則:order by case when col is null then 0 else 1 end , col desc


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM