S-SQL Examples H

S-SQL Examples Home Page

Having

Postgresql documentation here

  (query (:select (:count 'c.id) 'r.name
                :from (:as 'countries 'c)
                :inner-join (:as 'regions 'r)
                :on (:= 'c.region-id 'r.id)
                :group-by 'r.name
                :having (:< (:count 'c.id) 10)))

((5 "Central Asia") (5 "North America") (6 "Central America"))