mysql update和case语句结合

UPDATEtestSETavg_discount_area = (CASEWHENavg_discount_area ='9.5折以上'THEN0WHENavg_discount_area ='(8.0~8.5)折'THEN1WHENavg_discount_area ='(6.5~8.0)折'THEN2WHENavg_discount_area ='(4.0~6.5)折'THEN3WHENavg_discount_area='(2.5~4.0)折'THEN4WHENavg_discount_area='(1.0~2.5折)'THEN5WHENavg_discount_area ='1折以下'THEN6WHENavg_discount_area ='无数据'THEN7END);

你可能感兴趣的:(mysql update和case语句结合)