题解 | #对顾客ID和日期排序#
对顾客ID和日期排序
https://www.nowcoder.com/practice/fa4eb4880d124a4ead7a9b025fe75b70
题解
先对顾客ID进行排序,再按订单日期倒序排列
select cust_id, order_num from Orders order by cust_id, order_date desc
注意:多个字段排序,字段直接用逗号分隔;默认不写或asc
为升序,desc
为倒序
对顾客ID和日期排序
https://www.nowcoder.com/practice/fa4eb4880d124a4ead7a9b025fe75b70
select cust_id, order_num from Orders order by cust_id, order_date desc
注意:多个字段排序,字段直接用逗号分隔;默认不写或asc
为升序,desc
为倒序
相关推荐