解决方案 »
- 求1连接sql
- 求oracle 7.3版本
- oracle 关于列数据的替换问题。急!!!!在线等!!!!!!
- oracle 数据导入: 不导aa和bb表,其余的都导怎么写?
- 执行查询语句时出现违反协议的错误
- 为什么在外编辑器写好的SQL语句,在SQL PLUS 中执行出现错误?
- PL/SQL过程中中嵌入HTML,为什么创建成功,却看不到页面?
- 有用form builder的朋友,麻煩幫我看一下這個問題(form builder 6i)
- 配置工具Oracle Database Configuration Assisant时提示一下错误!
- 树形查询sql
- 急急急!!!如何在pl/sql中实现
- JDBC中,获取oracle表中的主键问题
where not exists(
select 1 from table1 where a=t.b and b=t.a and a>t.a)
select 1 a,2 b,'1,2' ab from dual
union all
select 2 a,1 b,'2,1' ab from dual
)
select * from temp where a = (round(dbms_random.value)+1)
delete from table1 t
where exists(
select 1 from tmp where a=t.b and b=t.a and a<t.a)
就选出一条了,
楼主的描述跟问题严重不符合啊!根据问题描述,去掉任意一行的话,delete from tb where rownum=1; 就好了。至于重复行记录去掉的,要看有几个字段,才好写sql语句,加入你表tb 有id主键、c1、c2、c3。那么重复的记录就是c1、c2、c3字段重复吧。
那么删除重复行的sql就是
delete from tb t2
where exists(select 1 from tb t1 where t1.c1=t2.c1 and t1.c2=t2.c2 and t1.c3=t2.c3 and t1.id<>t2.id)
这不就搞定了吗?
WHERE ROWID != (SELECT MAX(ROWID)
FROM tt b
WHERE (a.a = b.a AND a.b = b.b) OR
(a.a = b.b AND a.b = b.a));