mysql HAVING代码用例
时间: 2023-10-29 07:48:09 浏览: 91
MySQL中USING 和 HAVING 用法实例简析
Sure, here's an example of using HAVING in MySQL:
SELECT customer_id, COUNT(order_id) AS order_count
FROM orders
GROUP BY customer_id
HAVING order_count > 5;
This will retrieve the customer ID and order count for any customers who have placed more than five orders. HAVING is used to filter the results of GROUP BY queries based on the aggregate functions.
阅读全文