mysql update case when then select case when then

SELECT CASE

WHEN a > b

THEN ‘a>b’

WHEN a = b

THEN ‘a=b’

ELSE ‘a<b’

END AS ‘结果’

FROM maxthree

update maxthree set a=

case

when a>b then 1

when a=b then 0

when a<b then 2

end

出处:http://www.iphpmysql.cn/mysql-update-case-when-then-select-case-when-then.html

posted @ 2015-07-06 17:15  邹邹  Views(650)  Comments(0)    收藏  举报