difference between 'where' and 'having'

Поиск
Список
Период
Сортировка
От Adam Šindelář
Тема difference between 'where' and 'having'
Дата
Msg-id 1a3f89540804281222l14ff6f28u8c7667d46cc65511@mail.gmail.com
обсуждение исходный текст
Ответы Re: difference between 'where' and 'having'  ("Richard Broersma" <richard.broersma@gmail.com>)
Re: difference between 'where' and 'having'  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: difference between 'where' and 'having'  (Emil Obermayr <nobs@nobswolf.info>)
Re: difference between 'where' and 'having'  ("Adam Šindelář" <adam.sindelar@gmail.com>)
Список 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 that:

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.

Adam

В списке pgsql-novice по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: index with no column
Следующее
От: "Richard Broersma"
Дата:
Сообщение: Re: difference between 'where' and 'having'