SQL的问题
UPDATE A SET A1=A1*2 WHERE A2 ON (SELECT A2 FORM B WHERE B1=2)
如何用内联接代替???
------解决方案--------------------UPDATE A
SET A.A1=ta.A1*2
FROM B tb
JOIN A ta
ON ta.A2 = tb.A2
WHERE tb.B1=2
------解决方案--------------------UPDATE A SET A1=A1*2 WHERE A2 ON (SELECT A2 FORM B WHERE B1=2)
改成内联
update A inner join B on A.A2=B.A2 and B.B1=2 set A1=A1*2
------解决方案--------------------我想,我上面的写法是错的,应该这样,
UPDATE A
SET A.A1=A.A1*2
FROM B tb
WHERE A.A2 = tb.A2 AND tb.B1=2
显然,SQL 也是我的弱项 :P, 希望没有误倒你
------解决方案--------------------星星乱写。
update A set A1 = A1 * 2 from A
inner join B on A.A2 = B.A2
where B.B1 = 2
------解决方案--------------------update A set A.A1 = A.A1 * 2 from A
inner join B on A.A2 = B.A2
where B.B1 = 2
------解决方案--------------------update A set A.A1 = A.A1 * 2 from Table1 A
inner join Table2 B on A.A2 = B.A2
where B.B1 = 2
------解决方案--------------------阿灰
你也是老人了
何必呢
呵呵