SELECT counts
От | Jayadevan M |
---|---|
Тема | SELECT counts |
Дата | |
Msg-id | OF3D569B61.E52FEDB0-ON65257767.003243F5-65257767.00330BFC@ibsplc.com обсуждение исходный текст |
Ответ на | Re: Select only active entries ("Carel Combrink" <s25291930@tuks.co.za>) |
Ответы |
Re: SELECT counts
|
Список | pgsql-novice |
Hello all, I have a table with id and status_v. create table myt (id integer, status_v varchar(10)); insert into myt values (1,'I'); insert into myt values (1,'P'); insert into myt values (1,'T'); insert into myt values (2,'P'); User gets counts of status records, filtered on some status_v like this test=# select count(*), status_v from myt where status_v in ('I','P','X') group by status_v; count | status_v -------+---------- 1 | I 2 | P (2 rows) Is there a way in which I can have the output as 1 | I 2 | P 0 | X i.e., if there is not data, the count should be displayed as 0. Regards, Jayadevan DISCLAIMER: "The information in this e-mail and any attachment is intended only for the person to whom it is addressed and may contain confidential and/or privileged material. If you have received this e-mail in error, kindly contact the sender and destroy all copies of the original communication. IBS makes no warranty, express or implied, nor guarantees the accuracy, adequacy or completeness of the information contained in this email or any attachment and is not liable for any errors, defects, omissions, viruses or for resultant loss or damage, if any, direct or indirect."
В списке pgsql-novice по дате отправления: