十五年测试老手,长期负责WEB\APP 项目测试,目前主要负责团队管理工作。

mysql update不能直接使用select的结果

上一篇 / 下一篇  2011-02-27 22:31:19 / 个人分类:mysql

在sql server中,我们可是使用以下update语句对表进行更新:

 update a set a.xx= (select yy from b) where a.id = b.id ;

a_\-e,P x0

但是在mysql中,不能直接使用set select的结果,必须使用inner join:51Testing软件测试网Io.W8F0^C Fd6N Y o

 update a inner join (select yy from b) c on a.id =b.id  set a.xx = c.yy51Testing软件测试网r+oyp Y,dj


TAG: MySQL mysql MYSQL

 

评分:0

我来说两句

Open Toolbar