Re: COUNT

Поиск
Список
Период
Сортировка
От Daniel Wickstrom
Тема Re: COUNT
Дата
Msg-id 14831.15805.753626.426101@gargle.gargle.HOWL
обсуждение исходный текст
Ответ на Re: COUNT  ("Brian C. Doyle" <bcdoyle@mindspring.com>)
Список pgsql-sql
>>>>> "Brian" == Brian C Doyle <bcdoyle@mindspring.com> writes:
   Brian> Hello, You will need to do "SELECT count(attribute) FROM   Brian> table;" or SELECT count(table.attribute);"


You need to watch this:


acspg=# create table tst (
acspg(# a integer
acspg(# );
CREATE
acspg=# insert into tst values (0);
INSERT 333481 1
acspg=# insert into tst values (null);
INSERT 333482 1
acspg=# insert into tst values (2);
INSERT 333483 1
acspg=# select count(*) from tst;count 
-------    3
(1 row)

acspg=# select count(a) from tst;count 
-------    2
(1 row)

acspg=# select count(1) from tst;count 
-------    3
(1 row)

acspg=# 


If you use the attribut name, null values won't be counted.

-Dan


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

Предыдущее
От: Jie Liang
Дата:
Сообщение: Re: COUNT
Следующее
От:
Дата:
Сообщение: Re: COUNT