Oracle中多表删除的问题 有两张表 A, B我现在想删除A条件是 A.id = B.id A.name <> B.name这个SQL语句怎么写? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 delete from A where exists (select 1 from B where A.id = B.id and A.name <> B.name) 依照上面的执行后,出错: ORA-00911: 无效字符这是什么意思啊?表中字段id和name都是有的啊不过这个"select 1"不明白.为什么是"select 1"啊? 同意 xiaoxiao1984(笨猫一只^_^) 的re:出错: ORA-00911: 无效字符肯定是你自己抄错了;RE:不过这个"select 1"不明白.为什么是"select 1"啊?你也可以用2,3,4,* ,等等代替建议多看些基础知识吧! SQL> select *from a1; ID NA---------- -- 1 A1 2 A3 3 A2 4 B1SQL> select *from b1; ID NA---------- -- 4 B4 3 B2 2 B3 1 B1SQL> delete from A1 2 where exists (select 1 from B1 where A1.id = B1.id and A1.name <> B1.name);已删除4行。不知道楼主为什么不能执行,where exists (select 1 ...) 表明的是只要存在记录即可,可以select 1 ...或者select id ...或者其他的字段也可以 跪求sql语句!!!! oracle数据导出问题 sqlldr 的问题 问两个SQL语句的区别 oracle 自定义函数SQL问题 row_number()的使用请教, 知道的都请进来指点指点 sql语句跟踪的问题 在oracle中,用SQL语句怎样将一个表的所有列标题用逗号连接起来,组成一个字符串,并去掉最后一个逗号? 如何设定UTL_FILE生成文件的字符集? 雪地里跪求关于oracle方面的好书 大量数据的统计功能问题 oracle字段类型是字符,值是ip,如何判断大小
where exists (select 1 from B where A.id = B.id and A.name <> B.name)
出错: ORA-00911: 无效字符这是什么意思啊?
表中字段id和name都是有的啊不过这个"select 1"不明白.为什么是"select 1"啊?
你也可以用2,3,4,* ,等等代替
建议多看些基础知识吧!
---------- --
1 A1
2 A3
3 A2
4 B1SQL> select *from b1; ID NA
---------- --
4 B4
3 B2
2 B3
1 B1SQL> delete from A1
2 where exists (select 1 from B1 where A1.id = B1.id and A1.name <> B1.name);已删除4行。不知道楼主为什么不能执行,where exists (select 1 ...) 表明的是只要存在记录即可,可以select 1 ...或者select id ...或者其他的字段也可以