我的表中记录形式如下
ID NAME
======================
1 名称一
2 名称一
3 名称一
4 名称二
5 名称二
6 名称二
我想让select语句选出如下记录集
1 名称一
4 名称二
请问这样的select语句要怎么写?注:我用的是Oracel
select id ,DISTINCT name
from 表名
select * from table a where rowid in(select max(rowid) from table where id=a.id and name =a.name)
我没有测试
测试正确后记得给分哦
select min(id),name from table_name group by name;
select * from table1 a
where a.rowid in(select min(b.rowid) from table1 b where b.name =a.name)