SELECT * from ( SELECT ROW_NUMBER() OVER(PARTITION by wj ORDER BY px desc)idx,px,wj from table ) ord where ord.idx = 1
wj :关联外键
px :排序字段
ROW_NUMBER:该函数可以对分组进行编号
PARTITION by :对wj这个字段进行分组
搜索
复制