update中使用select结果

[ 2008-04-11 09:22:02 | 作者: admin ]
字号: | |
p.s. 下面是常见的例子

简单例子
引用
update t1 set totals=(select count(*) from t1 b where b.id=a.id ) from t1 a
复杂例子(跟新多个字段的情况)
引用
update a set (name1,age1) =(select name2,age2 from b where a.id=b.id)
where exists(select 1 from b where a.id=b.id);
[最后修改由 admin, 于 2008-05-25 15:19:06]
评论Feed 评论Feed: http://blog.xg98.com/feed.asp?q=comment&id=1082

这篇日志没有评论。

此日志不可发表评论。