Sql server update/delete 和 join联查

update A set a.name = 'testName'
from A a
join b on a.id = b.destId
join c on b.destId = c.sourceId
where a.id > 0 and c.name = 'test'



delete a from A a
join b on a.id = b.destId
join c on b.cid = c.id
where c.name = 'tets'

猜你喜欢

转载自blog.csdn.net/Helloantoherday/article/details/116948249