| От | Bruno Wolff III |
|---|---|
| Тема | Re: select syntax question |
| Дата | |
| Msg-id | 20021101215900.GA2290@wolff.to обсуждение исходный текст |
| Ответ на | select syntax question (Wei Weng <wweng@kencast.com>) |
| Список | pgsql-sql |
On Fri, Nov 01, 2002 at 16:33:32 -0500, Wei Weng <wweng@kencast.com> wrote: > This is what is on postgresql's manual page: > > According to this syntax, SELECT DISTINCT COUNT(ID) FROM test > should be valid while SELECT COUNT(DISTINCT ID) FROM test otherwise. > > while in fact, both are valid. > > Is there any difference between this two queries? They mean different things. The first will return the number of rows with non-null values for id. Since only one row is returned it is guarenteed to be distinct so the distinct keyword will have no effect. The second form will return the number of distinct, non-null values for id in the table.
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера