delete from table a where exists (select * from table_2 b where a.nid=b.nid)update table a set nname=( select nname from table_2 b where a.nid=b.nid ) where exists (select * from table_2 where a.nid=nid)
表: create table AAAA ( AAA VARCHAR2(10) not null ) 表中数据: AAA 11 22 33 44 下面的SQL有什么错误?为什么提示“SQL命令未正确结束”? insert into AAAA (AAA) values ('77') where exists(select * from AAAA where AAA='11')
SQL> INSERT INTO AAAA SELECT '77' FROM DUAL WHERE EXISTS(SELECT 1 FROM AAAA WHERE AAA='11');已创建 1 行。SQL> SELECT * FROM AAAA;AAA ---------- 11 22 77用这种方法实现 你可以查一下insert into的用法支不支持那样使用
where exists (select * from table_2 b where a.nid=b.nid)update table a set nname=(
select nname from table_2 b
where a.nid=b.nid
)
where exists (select * from table_2 where a.nid=nid)
create table AAAA
(
AAA VARCHAR2(10) not null
)
表中数据:
AAA
11
22
33
44
下面的SQL有什么错误?为什么提示“SQL命令未正确结束”?
insert into AAAA (AAA) values ('77') where exists(select * from AAAA where AAA='11')
SQL> INSERT INTO AAAA SELECT '77' FROM DUAL WHERE EXISTS(SELECT 1 FROM AAAA WHERE AAA='11');已创建 1 行。SQL> SELECT * FROM AAAA;AAA
----------
11
22
77用这种方法实现 你可以查一下insert into的用法支不支持那样使用