mysql更新

UPDATE souyue02.sy_category_info
    SET sort_index = CASE cate_name
        WHEN '图集' THEN 8
        WHEN '段子' THEN 9
        WHEN 'GIF' THEN 10
WHEN '科技' THEN 5
WHEN '财经' THEN 4
WHEN '国际' THEN 11
WHEN '军事' THEN 12
WHEN '房产' THEN 13
WHEN '时尚' THEN 14
WHEN '女人' THEN 15
WHEN '教育' THEN 16
WHEN '历史' THEN 17
WHEN '汽车' THEN 18
WHEN '星座' THEN 19
WHEN '游戏' THEN 20
WHEN '搏击' THEN 21
    END
WHERE cate_name IN ('图集','段子','GIF','科技','财经','国际','军事','房产','时尚','女人','教育','历史','汽车','星座','游戏','搏击')

猜你喜欢

转载自love398146779.iteye.com/blog/2274030