Example:
select orderno,sum(price)
from orderrow
where orderdate > date('2002-01-01')
group by sum(price)
having sum(price) > 1000
order by orderno;
This means:
get me all ordernumbers and sum of price in orderrow table with the limit that orderdate should be after 1 jan and the price sum is more than 1000. Sort on ordernumber.
Group by is used together with aggregate functions (sum, count, max, min, avg...).
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.