我想知道是否有更好的方法来编写此更新语句:
update table A
set item = (select itemA + ' - ' + itemB from table B where id = 1),
temp = (select itemA from table B where id = 1)
where sid = (select sItemId from table B where id = 1)
用于JOINS
提高效率和Alias
可读性。
UPDATE A
SET A.item = B.itemA + ' - ' + B.itemB
,A.temp = B.itemA
FROM tableA A
INNER JOIN tableB B ON A.[sid] = B.sItemId
where B.id = 1
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句