Skip site navigation (1) Skip section navigation (2)

difference between 'where' and 'having'

From: Adam Šindelář <adam(dot)sindelar(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: difference between 'where' and 'having'
Date: 2008-04-28 19:22:11
Message-ID: (view raw or whole thread)
Lists: pgsql-novice
Hi, I have a question, that's probably really stupid, but could someone
please explain to me what difference there is between a WHERE clause and a
HAVING clause besides the syntax? I read the documentation where it states

Expressions in the HAVING clause can refer both to grouped expressions and
to ungrouped expressions (which necessarily involve an aggregate function).

I've been happily working with Postgres for a long time, and not once have I
ever used a HAVING in my queries, even in fairly complex ones, and I just
can't bear the suspense anymore! :)

Thanks in advance for clearing this up for me.



pgsql-novice by date

Next:From: Richard BroersmaDate: 2008-04-28 19:45:12
Subject: Re: difference between 'where' and 'having'
Previous:From: Tom LaneDate: 2008-04-26 20:07:47
Subject: Re: index with no column

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group