一、更新一列
1) 格式一
update b_owchcp_partner_url set chapterlist_url =
(case when pid = 3 then 'http://www.baidu.com'
when pid = 2 then 'http://www.baidu.com'
when pid = 6 then 'http://www.baidu.com'
end
);
2) 格式二
update b_owchcp_partner_url set chapterlist_url =
(case pid when 3 then 'http://www.baidu.com'
when 2 then 'http://www.baidu.com'
when 6 then 'http://www.baidu.com'
end
);
1) 格式一
update b_owchcp_partner_url set chapterlist_url =
(case when pid = 3 then 'http://www.baidu.com'
when pid = 2 then 'http://www.baidu.com'
when pid = 6 then 'http://www.baidu.com'
end
);
2) 格式二
update b_owchcp_partner_url set chapterlist_url =
(case pid when 3 then 'http://www.baidu.com'
when 2 then 'http://www.baidu.com'
when 6 then 'http://www.baidu.com'
end
);
二、更新多列
update table
set colume1 =(case pid
when 3 then 'aaa'
when 2 then 'bbb'
else 'ccc'
end),
colume2 = (case pid
when 3 then 'ccc'
when 2 then 'ddd'
end);