摘要:
select name from greatestsORDER BY case when name ='B' then 1 when name ='A' then 2 when name ='D' then 3 when name ='C' then 4 else 5 end 阅读全文
摘要:
select name, case when case when x > y then x else y end < z then z else case when x < y then y else x end end as greasterfrom greatests 阅读全文
摘要:
select case when sex = 1 then '男性' else '女性' end as '性别', sum(case when name='哈尔滨' THEN population else 0 end) as '哈尔滨', sum(case when name='大庆' then 阅读全文
摘要:
1.只加入一个社团的学生的社团id select std_id, max(club_id) from student_clubgroup by std_idhaving count(*) =1 2.加入多个社团的学生的主社团id select std_id,club_id from student_ 阅读全文
摘要:
进行不同条件的统计是case表达式的著名用法之一 select name,sum(case when sex = 1 then population else 0 end) as cnt_m,sum(case when sex = 2 then population else 0 end) as c 阅读全文
摘要:
1.对当前工资为30万日元以上的员工,降薪10%;2.对当前工资为25万日元以上且不满28万日元的员工,加薪20% update salaries set salary = case when salary >=300000 then salary*0.9 when salary >=250000 阅读全文