Selecting Groups - the HAVING Clause
HAVINGclause restricts the selection of groups in the same way that a
WHEREclause restricts the selection of rows. However, in contrast to the
HAVINGclause may use a set function on the left-hand side of a comparison.
HAVINGclause is most often used together with a
GROUP BYclause, 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