Skip site navigation (1) Skip section navigation (2)

RE: COUNT doesn't shows items with 0 occurrance

From: "Robby Slaughter" <webmaster(at)robbyslaughter(dot)com>
To: "Giorgio A(dot)" <jh(at)libero(dot)it>, <pgsql-novice(at)postgresql(dot)org>
Subject: RE: COUNT doesn't shows items with 0 occurrance
Date: 2001-07-17 16:14:19
Message-ID: EPEHLKLEHAHLONFOKNHNIEPCDCAA.webmaster@robbyslaughter.com (view raw or flat)
Thread:
Lists: pgsql-novice
Giorgio,

Sounds like (but correct me if I'm wrong) you have a table like:

  pieces
 --------
  hammer
  nails
  hammer
  screws
  ruler

If you do a select count(*) on this table and include a group by,
it's just going to give you the statisitcs

hammer  2
nails   1
screws  1
ruler   1

So I'm not really sure what you're asking. Maybe you could give
an example of what is in your table and what you are trying to
get out?

-Robby

-----Original Message-----
From: pgsql-novice-owner(at)postgresql(dot)org
[mailto:pgsql-novice-owner(at)postgresql(dot)org]On Behalf Of Giorgio A.
Sent: Tuesday, July 17, 2001 10:01 AM
To: pgsql-novice(at)postgresql(dot)org
Subject: [NOVICE] COUNT doesn't shows items with 0 occurrance


hi all,
i have this little problem: when i do a

SELECT COUNT (*) AS number, pieces
FROM hardware
GROUP BY pieces

if a pieces has 'number = 0' it's not shown in the result report ... how can
i fix this, having as a result the whole list of my hardware pieces ?

tnx !

have a nice day

Giorgio A.



---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
message can get through to the mailing list cleanly


In response to

pgsql-novice by date

Next:From: Robby SlaughterDate: 2001-07-17 17:08:19
Subject: RE: sequence primary key
Previous:From: Virginie GarciaDate: 2001-07-17 15:43:53
Subject: sequence primary key

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group