日期:2014-05-16  浏览次数:20396 次

oracle根据列查询不重复的行

表:TEST_ORDERY
col1 col2
1     1
1     2
1     3
2     1
2     3
3     1
4     1
5     1
5     2
6     2



oracle根据列查询不重复的行


查出记录为:
col1     col2
1         1
2         1
3         1
4         1
5         1
6         2


oralce语句为:
SELECT * FROM TEST_ORDERY WHERE rowid IN 
(SELECT min(rowid) FROM TEST_ORDERY GROUP BY COL1) order by col1,col2;