SQL分组排序去重复的小实例
代码如下:
SELECT * FROM ( SELECT userid, classid, remark, ROW_NUMBER () OVER ( PARTITION BY userid, classid ORDER BY addtime DESC ) AS row_bank FROM Eng24VIPCourseIntention ) AS ta WHERE row_bank = 1
==========================
PARTITIONBYuserid,classid 这里是按什么分组, 注意一下。
相关推荐
zjyzz 2014-12-08
li00lee 2018-04-15
godfather 2020-06-26
ItBJLan 2020-06-17
dreamhua 2020-06-05
明月清风精进不止 2020-04-21
明月清风精进不止 2020-02-17
ALiDan 2020-01-12
ztyzly00 2020-01-12
ALiDan 2020-01-04
tanrong 2019-12-28
dreamhua 2019-12-26
81911536 2019-12-14
xiaobaif 2019-12-13
一对儿程序猿 2019-12-08
azhou 2019-10-22
oraclemch 2019-07-05
sqlitexin 2019-07-25
汉武帝刘彻 2019-03-19