| От | Clinton Adams |
|---|---|
| Тема | Re: Do I just not understand count() |
| Дата | |
| Msg-id | 20020408185126.022E347589D@postgresql.org обсуждение исходный текст |
| Ответ на | Do I just not understand count()? (Ben <bench@silentmedia.com>) |
| Список | pgsql-general |
> If I have the table t defined as: > > a > --- > 1 > 1 > 2 > > > and I say: > > select count(a=1) from t; > > should it give me 1 or 2 as a result? I'm getting 2, and I'd think I > should get 1.... It will give you a result of 3, as a=1 does not toss out rows for which a <> 1. You would need to add some parameters to limit the rows that count is countin... select count(a) from t where a = 1 would give you 2 select count(DISTINCT a) from t where a = 1 would give you 1 > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера