我现在有一个sql如下
select a,count(a) count_num,days from
(select a,case when days < 60 then '库存小于60天' WHEN DAYS <=90 AND DAYS >=60 THEN '60-90天' ELSE '大于90天' end days fr om
(select a,
(格式化) DAYS
from A
where sn.STORAGETYPE not in('S01','918','920')
) a)b
group by a,DAYS
简化
select a,b,count(c) from A group by a,b order by ?
解释:也就是说我现在想要对两个数来分组排序,但是排序的结果想要按其中某个字段分组后count的值去排序,怎么实现?