可以,
select count(*)
from table a
where exists (select * from table_2 b where a.nid=b.nid)

解决方案 »

  1.   

    不好意思,我的意思是:在update和insert或者delete语句中可以用吗?
      

  2.   

    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)
      

  3.   

    可以,当然可以dml语句中都可以
      

  4.   

    exists是开关判断语法,用到where后的,当然update和insert或者delete也能用
      

  5.   

    表:
    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')
      

  6.   


    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的用法支不支持那样使用