16,553
社区成员
发帖
与我相关
我的任务
分享
;with cte(商品,规格) as
(
select 'A','大'
union all select 'B','中'
union all select 'C','小'
union all select 'A','中'
union all select 'A','小'
union all select 'C','小'
)
select top 1 *
from (select 商品,规格,count(*) as num
from cte
group by 商品,规格
)t
order by num desc
/*
商品 规格 num
C 小 2
*/