SQL中使用update inner join和delete inner join

t-sql


Update XXX set XXX where 这种写法大家都知道,

这里update和delete支持inner join的update 的定法


update tb_User
set pass=''
from tb_User usr
inner join tb_Address addr on usr.nAddressFK = addr.nAddressID
where usr.id=123

update的格式是

update t1 set t1.name=’Liu’ from t1 inner join t2 on t1.id = t2.tid

delete 语句也是类似

delete from t1 from t1 inner join t2 on t1.id = t2.tid

 

posted @ 2015-02-05 16:42  以函  阅读(15815)  评论(0编辑  收藏  举报