SQL:
  Update 
    (Select a1,a2 from A)
   set a1 = 1
  where 1=1;
  commit;
请问,表A中的数据会被更新吗??

解决方案 »

  1.   

    一般人都不会那样写sql语句了,这样写是最简单不过
    update A set a1=1;
    commit ;
      

  2.   

    Update 
        (Select A.a1 a1,B.b1 b1 from A,B where A.a1=B.b1) 
      set a1 = 1 
      where 1=1; 
    提交后,这样对数据库中的数据有影响吗??
      

  3.   

    楼主,你写的update,不符合语法吧.正确的如下:
    syntax:
    Update <tablename>
    set <columnname1> = <expression1>[<columnname2> = <expression2>,...]
    [where <condition>];
      

  4.   

    亲自试了一下,确实可以:
    create table temp1
    (
    userName varchar(20),
    counts int
    )
    insert into temp1 values('AA',10);
    insert into temp1 values('BB',71);
    insert into temp1 values('CC',15);
    insert into temp1 values('DD',66);
    执行下面的sql,通过,没问题
    update (select userName,Counts from temp1) set counts =50 where 1 =1;
      

  5.   

    Select A.a1 a1,B.b1 b1 from A,B where A.a1=B.b1 
    只是得到一个记录集,跟临时表没什么关系