count and having in mysql code example
Example 1: SQL only show where count is great than 1
SELECT COUNT( * )
FROM agents
HAVING COUNT(*)>1; --count is greater than 1
Example 2: having in mysql
SELECT
ordernumber,
SUM(quantityOrdered) AS itemsCount,
SUM(priceeach*quantityOrdered) AS total
FROM
orderdetails
GROUP BY
ordernumber
HAVING
total > 1000;