我有 2 张桌子:
1.customer (contains customers)
2.customer_order (contains orders)
我想知道这个:
no. of customers with 0 orders
no. of customers with 1 order
no. of customers with 2 orders
etc
我有这个:
SELECT COUNT(co.id)
FROM customer c
LEFT JOIN customer_order co
ON c.id=co.id_customer
GROUP BY ??? ;