sql 常用手册
根据code 分组然后取出每组中的任意一行
SELECT *from(
SELECT
*, row_number () OVER (
partition BY code
ORDER BY
code DESC
) rowid
FROM
dept
) t
WHERE
rowid = 1;
SQL中相关子查询
https://www.cnblogs.com/xcyjblog/p/14841168.html
https://www.cnblogs.com/chenmh/p/3998614.html
https://www.cnblogs.com/mazey/p/6517744.html