DataBase/Mysql

MySql orderBy null first /null last 정렬

민돌v 2022. 7. 5. 14:05
728x90

mysql 에서 orderby 시, null 값이 먼저나오는 null frist한 모습을 보여주는데, null 값은 뒤로가고, 그게 아닌 값들에 대한 오름 차순 정렬값이 먼저나왔으면 했다.

select * from goods order by out_sequence;

 

오라클은 null frist 랑 null Last가 되는데, mysql은 왜 안되냐 ㅡㅡ

 

 

select * from goods order by out_sequence is null asc, out_sequence asc;

//똑같다
select * from goods order by out_sequence is null, out_sequence;

 

 

 

 

*참고

https://ismydream.tistory.com/158

반응형