-
> *From:* Another Trad
> *To:* Oliveiros C,
> *Cc:* pgsql-sql@postgresql.org
> *Sent:* Wednesday, November 18, 2009 5:37 PM
> *Subject:* Re: [SQL] need nelp with aggregate functions
>
> ok, I did: SELECT count(DISTINCT c.cliente_id) as
> qtd_client,count(cm.cm_id) as qtd
appearing more than once...
It's basically that...
Hope this helped
Best,
Oliveiros
- Original Message -
From: Another Trad
To: Oliveiros C,
Cc: pgsql-sql@postgresql.org
Sent: Wednesday, November 18, 2009 5:37 PM
Subject: Re: [SQL] need nelp with aggregate functions
ok, I did: SELECT count(DISTINCT c.cliente_id) as qtd_client,count(cm.cm_id)
as qtd_computers
GREAT. It works.
Please, explain me why and how it works, I wanna learn and do by myself next
time :)
2009/11/18 Oliveiros C,
> Try substituting the SELECT count(c) as qtd_client,count(cm) as
> qtd_co
Try substituting the SELECT count(c) as qtd_client,count(cm) as qtd_computers
by
SELECT count( DISTINCT c.cliente_id) as qtd_client,count(/* put here the
primary key of the computer table */ ) as qtd_computers
Then tell me if it output what you want
Best,
Oliveiros
- Original Message --
On Wed, Nov 18, 2009 at 9:55 AM, Another Trad wrote:
> The DB structure is in attachment.
> I with the number of clients and the number of computers that have
> processors with "manufacturer" = "INTEL" and "speed" = "2GB"
> I am trying:
>
> select count(c) as qtd_client, count(cm) as qtd_computers