different results using count(x)

Поиск
Список
Период
Сортировка
От Raimon Fernandez
Тема different results using count(x)
Дата
Msg-id D1D05BDE-8B65-4D8D-B00A-917971633863@montx.com
обсуждение исходный текст
Ответ на Re: boot on Debian with /etc/init.d/rc ...  (Raimon Fernandez <coder@montx.com>)
Ответы Re: different results using count(x)  (Raimon Fernandez <coder@montx.com>)
Список pgsql-novice
Hello,


What's the difference between:

SELECT count(id) FROM scanns WHERE tipus='esc'; => 11235
SELECT count(pages) FROM scanns WHERE tipus='esc'; => 11165
SELECT count(*) FROM scanns WHERE tipus='esc'; => 11235

Why are some rows that aren't included in the count(pages) SELECT ?

There are not NULL values in the pages field:

SELECT count(pages) FROM scanns WHERE tipus='esc' AND pages IS NOT
NULL; => 11165
SELECT count(pages) FROM scanns WHERE tipus='esc' AND pages IS NULL;
=> 0

And I think the three SELECTS should return the same rows number ...


thanks for your help,

r.


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

Предыдущее
От: Michael Wood
Дата:
Сообщение: Re: problem loading sql to database?
Следующее
От: Raimon Fernandez
Дата:
Сообщение: Re: different results using count(x)