在MySQL中
Table1 columns Id, Foo, Bar, Choc, Blk, AB
Table2 columns ID, A, B, C
我试图用
的结果更新表1 col ABIF( (C / ((A + B)/ 2))>1, "A...", "B..." ) from Table2
Where T1.id =t2.id
答案 0 :(得分:4)
UPDATE table1
JOIN Table2 on Table1.id = Table2.id
SET AB = CASE WHEN C / ((A + B)/ 2) > 1 THEN "A..." ELSE "B..." END