1、更新某一列的多个值(表中字段有id,sex,sex有值f与m,将f与m互换)
(update table set column = (case column when 'value1' then 'value2' when 'value2' then 'value1' else 'value4' end))
update table set sex = (case sex when 'f' then 'm' else 'f' end);
2、获取表中连续出现三次的值(表中字段有Id,num,获取num出现连续出现三次的值)
select distinct num from tableName table1,tableName table2,tableName table3
where table1.num = table2.num
and table2.num = table2.num
and table1.id = table2.id - 1
and table2.id = table3.id - 1