一段复合查询的sql语句备份 排序 group

来源:互联网 发布:手机打开docx软件 编辑:程序博客网 时间:2024/05/01 11:26
select * from brands b join (select brand_id,count(*) as product_amount from products where id in (#{product_id_array.join(',')}) group by brand_id order by count(*) desc) as bc where b.id = bc.brand_id order by bc.product_amount desc
原创粉丝点击