fixed #53, rewrote query to get rid of the PostgreSQL error with having clause
Merge pull request #57 from franzose/2.0

fixed #53, rewrote query to get rid of the PostgreSQL error with having ...