其他分享
首页 > 其他分享> > order by a desc,b desc与order by a,b desc的区别

order by a desc,b desc与order by a,b desc的区别

作者:互联网

通过下面sql看出 order by 默认是asc 。相当于select * from order_table order by id1 asc

通过下面两个图可知,

 select * from order_table order by id1,id2 desc不等于 select * from order_table order by id1 desc,id2 desc.

select * from order_table order by id1,id2 desc等于select * from order_table order by id1 asc,id2 desc

通过上图和下图可知,select * from order_table order by id1 desc,id2 desc不等于 select * from order_table order by id2 desc,id1 desc.谁在前优先级高,先排序id1,id1相同的情况下再排序id2

标签:区别,id2,id1,table,order,select,desc
来源: https://blog.csdn.net/yan_xian_gang/article/details/121095250