Re: need nelp with aggregate functions

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Another Trad <anothertrad(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: need nelp with aggregate functions
Date: 2009-11-18 17:07:59
Message-ID: dcc563d10911180907vff9977ehf7352781340ea78f@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, Nov 18, 2009 at 9:55 AM, Another Trad <anothertrad(at)gmail(dot)com> 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
>
> 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'
>
> but is not working
> anyone can help me?

If you are getting an error message it's a good idea to post it as well.

However, first problem is that c and cm are tables, not fields. You
need to count some field from those tables.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Oliveiros C, 2009-11-18 17:16:52 Re: need nelp with aggregate functions
Previous Message Another Trad 2009-11-18 16:55:16 need nelp with aggregate functions