Selecting Groups - the HAVING Clause
The HAVING clause restricts the selection of groups in the same way that a WHERE clause restricts the selection of rows. However, in contrast to the WHERE clause, a HAVING clause may use a set function on the left-hand side of a comparison.
The HAVING clause is most often used together with a GROUP BY clause, but may also be used to impose selection conditions on a column derived from a set function.
Find the currency codes that are used by more than one country:SELECT currency_code, COUNT(currency_code) FROM countries GROUP BY currency_code HAVING COUNT(currency_code) > 1;
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40