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

sql

From: "cristi" <cristi(at)dmhi(dot)ct(dot)ro>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: sql
Date: 2004-06-23 10:43:50
Message-ID: 008601c4590e$f8a391e0$7202a8c0@cristiv (view raw or flat)
Thread:
Lists: pgsql-sql
I have the following table structure:

CREATE TABLE "xxx" (
 "co" character varying(7),
 "co1" character varying(9),
 "n1" character varying(15),
 "l1" character varying(5),
 "m1" smallint,
 "ore" bigint
);

who contains the following date:

22021CC 1044 637 S5G8 407 5
22021CC 1044 637 S5G8 409 47
22021CD 1044 637 S5G8 410 24
22022BB 1044 637 S5G8 409 10

I need a SQL select which result to be:

22021CC 1044 637 S5G8 407 5
22021CC 1044 637 S5G8 409 57
22021CD 1044 637 S5G8 410 24

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.

Wou!
Thanks in advance!



Responses

  • Re: sql at 2004-06-23 11:38:24 from Richard Huxton

pgsql-sql by date

Next:From: Richard HuxtonDate: 2004-06-23 11:38:24
Subject: Re: sql
Previous:From: sadDate: 2004-06-23 09:55:50
Subject: feature request ?

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