In MySQL
Table1 columns Id, Foo, Bar, Choc, Blk, AB
Table2 columns ID, A, B, C
Im trying to update table 1 col AB with result of
IF( (C / ((A + B)/ 2))>1, "A...", "B..." ) from Table2
Where T1.i开发者_开发知识库d =t2.id
UPDATE table1
JOIN Table2 on Table1.id = Table2.id
SET AB = CASE WHEN C / ((A + B)/ 2) > 1 THEN "A..." ELSE "B..." END
精彩评论