关于update
我需要一个效果:
update tb1 set a = (select b from tb2 where tb1.c = tb2.c)
要求:该结果集必然包含多个查询结果,理论上会报错。我想将此结果集用逗号之类连接起来更新进去使该语句不报错并达到效果,不能用循环后再udate。。。
感谢~
[解决办法]
update tb1 set a = (select b from tb2 where tb1.c = tb2.c)
//在select b from tb2 where tb1.c = tb2.c为一条记录的时候不会出错吧
[解决办法]
搞不定就用存储过程,,,,,那样就可以,适当加一点条件就OK
[解决办法]
//update tb1 set a = (select b from tb2 where tb1.c = tb2.c)
update tb1 set a=tb2.b
from tb1,tb2 where tb1.c=tb2.c
[解决办法]
楼主的这个要求。。。。基本上挺难实现
[解决办法]
select b from tb2 where tb1.c = tb2.c如果有从个结果,那是不太好办了!
[解决办法]
子查询不报错吗?
只from tb2,where 条件里却有tb1?