日期:2014-05-19  浏览次数:20459 次

求一SQL語句。謝謝!
現在有兩張表T1(id,date,money)和T2(id,bdate,edate)
我想修改表T1的money字段
條件是T1表的id要等於T2表的id,並且T1表的date要在T2表的bdate和edate之間.
請問用一SQL語句應該怎麼寫?謝謝!!!

------解决方案--------------------
update T1 set money=要修改的数值
from T2
where t1.id=t2.id and t1.date between t2.bdate and t2.edate
------解决方案--------------------
Update T1 Set [money] = 要修改的值
From T1 Inner Join T2 On T1.id = T2.id And T1.[date] Between T2.bdate And T2.edate
------解决方案--------------------
或者

Update T1 Set [money] = 要修改的值
From T1 , T2 Where T1.id = T2.id And T1.[date] Between T2.bdate And T2.edate