Re: need nelp with aggregate functions
От | Oliveiros C, |
---|---|
Тема | Re: need nelp with aggregate functions |
Дата | |
Msg-id | 971C9BA25C4948E08D128793220A7DEE@marktestcr.marktest.pt обсуждение исходный текст |
Ответ на | need nelp with aggregate functions (Another Trad <anothertrad@gmail.com>) |
Ответы |
Re: need nelp with aggregate functions
|
Список | pgsql-sql |
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 -----From: Another TradSent: Wednesday, November 18, 2009 4:55 PMSubject: [SQL] need nelp with aggregate functionsThe 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_computersbut is not working
from cliente c
inner JOIN computer cm on (c.cliente_id = cm.cliente_id)
inner join processor p on (cm.processor_id = p.processor_id)
inner join speed s on (s.speed_id = p.speed_id)
INNER JOIN manufacturer m on (p.manufacturer_id=m.manufacturer_id)
where m.manufacturer = 'INTEL'
and s.speed = '2GB'
anyone can help me?
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
В списке pgsql-sql по дате отправления: