select index,name,age from table
where index in
(
select index
from
(
select name,age,min(index) as index from table
group by name,age))
where index in
(
select index
from
(
select name,age,min(index) as index from table
group by name,age))
解决方案 »
- alter database open resetlogs的问题
- 关于PL/sql Developer的问题
- 求助:oracle10g冷备文件怎么恢复?
- oracle自己的oem 需要另安装吗? 我已经装了oracle 10g了。oem在哪?
- 比较难的一个统计
- 如何从数据库文件恢复数据库
- 本人没有分了,还得请教大哥如何冷启动ORACLE数据库
- 请问:使外键的约束失效的sql语句如何写啊?
- 新手的问题:“ERROR ORA-12560: TNS: 协议适配器”
- pl/sql 远程连接的问题
- 如何更改好多表中共同拥有的同一字段的长度,因为一个一个改太麻烦,请大侠赐教!
- 紧急求救有关Oracle程序的问题!!!!
delete from table
where index not in
(
select index
from
(
select name,age,min(index) as index from table
group by name,age))
--------------------------------------------------
NAME
--------------------------------------------------
1
lhg31
lhg22
lhg2
ID
--------------------------------------------------
NAME
--------------------------------------------------
1
lhg
SQL> delete from ( select * from tmp where tmp.rowid != (
2 select max(rowid) from tmp t where t.id= tmp.id)) Tp;已删除2行。SQL> select * from tmp;ID
--------------------------------------------------
NAME
--------------------------------------------------
2
lhg21
lhg
name --> id
select index, name, age,
dense_rank() over(
partition by name
order by index) dr
from table)
where dr = 1
order by index;
BTW: The Oracle's version is must 8i or higher!Hope this will help you.
where a.rowid < select max(rowid) from yourTable b where a.index=b.index);