Mysql是不是不支持在update和delete语句中使用子查询?
例如.
update tablename set id=9
where id>(select avg(id) from tablename)

解决方案 »

  1.   

    搞错了
    MySQL支持这个
    select * from tablename where id>(select avg(id) from tablename)
    不支持这个
    update   tablename   set   id=9 where   id> (select   avg(id)   from   tablename)
    因为不能修改以之为查询条件的表
      

  2.   

    如果子程序不涉及被update的表可以
      

  3.   

    update tablename1 set id=9 where id> (select avg(id) from tablename2)
    表不同也可以
      

  4.   

    因为不能修改以之为查询条件的表书上就是这么说的
    符合标准SQL语句
      

  5.   

    Access和SQL Server可以支持update tablename set id=9 where id> (select avg(id) from tablename)