sql语怎么样更新?
如下表结构:
A表
id paidtime
1
2
3
4
B表
id date
1 2013-11-21
2 2013-11-22
3 2013-11-24
4 2013-11-25
想把B表的date的记录,更新到A表的paidtime字段上,关联是A表 id 跟B表的id,一样。
如何用sql,整体更新记录?谢谢!!
[解决办法]
1:update A set paidtime=(select b.date from A a inner join B b on a.id=b.id )
2:update A set A.paidtime=B.date from B where A.id=B.id
update A set A.paidtime=B.[date] from A join B on A.id=B.id