Oracle 分组后取每组第一条数据
清泛原创
Oracle 分组后取每组第一条数据的SQL如下,亲测有效:
SELECT *
FROM (SELECT ROW_NUMBER() OVER(PARTITION BY T.field1, T.field2 ORDER BY T.field3 DESC) rowNo, T.*
FROM table_xxx T)
WHERE rowNo = 1;