select c.coutomer_id,count(o.order_id) as orders_ct
from customer c join orders o on c.customer_id = o.customer_id
where c.gender='f'
group by c.customer_id
having count(o.cutomer_id) > 4
order by oders_st,c.cutomer_id
from customer c join orders o on c.customer_id = o.customer_id
where c.gender='f'
group by c.customer_id
having count(o.cutomer_id) > 4
order by oders_st,c.cutomer_id
本文介绍了一段SQL查询代码,用于统计女性客户的订单数量。该查询从顾客表和订单表中联接获取数据,并按顾客ID分组,筛选出订单数超过4笔的女性顾客。结果将按照订单数量及顾客ID排序。
531

被折叠的 条评论
为什么被折叠?



