Re: sql

From: Richard Huxton <dev(at)archonet(dot)com>
To: cristi <cristi(at)dmhi(dot)ct(dot)ro>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: sql
Date: 2004-06-23 11:38:24
Message-ID: 40D96BB0.7020301@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

cristi wrote:
>
> I mean:
> I want to select the records wich for co1,n1,l1,m1 value are the same and
> has the maxim value of the ore field
> adding to that value the value of the records which are not selected.

SELECT co,clo1,nl,l1,m1,SUM(ore) AS tot_ore
FROM xxx
WHERE <conditions here>
GROUP BY co,clo1,nl,l1,m1
ORDER BY co,clo1,nl,l1,m1;

--
Richard Huxton
Archonet Ltd

In response to

  • sql at 2004-06-23 10:43:50 from cristi

Browse pgsql-sql by date

  From Date Subject
Next Message Clive Page 2004-06-23 15:45:41 Non-standard function names
Previous Message cristi 2004-06-23 10:43:50 sql