select name, category, salary where category = 'permanent' order by salary
union all
select name, category, salary where category = 'contract' order by salary
select name, category, salary where category = 'permanent' order by salary desc
union all
select name, category, salary where category = 'contract' order by salary desc
掉了薪水的逆排序select name, category, salary where category = 'permanent' order by salary desc
union all
select name, category, salary where category = 'contract' order by salary desc
。。。
还用这么麻烦。
直接select name, category, salary order by category, salary desc不就完了。。category里的“Permanent”的首字母本来就在“Contract”之前,按倒叙的话本身Perm就在前面。
掉了薪水的逆排序select name, category, salary where category = 'permanent' order by salary desc
union all
select name, category, salary where category = 'contract' order by salary desc
我在想如果category有20个value怎么办
可以 order by category = ('permanent', 'contract') 吗?
掉了薪水的逆排序select name, category, salary where category = 'permanent' order by salary desc
union all
select name, category, salary where category = 'contract' order by salary desc
试试这个select name, category, salary where category = 'permanent' order by salary
union all
select name, category, salary where category = 'contract' order by salary