pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Broersma Jr <rabroersma@yahoo.com>
To: marchesini@unipg.it
To: pgsql-sql@postgresql.org
Subject: Re: simple problem???
Date: Thu, 20 Jul 2006 13:47:52 -0700 (PDT)
Message-ID: <20060720204752.51889.qmail@web31813.mail.mud.yahoo.com> (raw)
In-Reply-To: <1153407157.5192.64.camel@geoivan>

> A|B|C
> 1|2|20
> 1|3|10
> 1|4|21
> 2|3|12
> 2|4|22
> 3|4|23
> 1|3|10
> 2|3|12
> 3|4|23
> -select all records where A=1, 
> -find, into this selection, the record where there's the minimum value
> of the field C 
> -print all the fields for this record.

maybe this will work;

select a,b,c
from table as T1
join (select a, min(c) as minc from table group by a) as T2
on (t1.a = t2.a) and (t1.c = t2.c)
;

Regards,

Richard Broersma Jr.



view thread (10+ messages)  latest in thread

Message-ID: <20060720204752.51889.qmail@web31813.mail.mud.yahoo.com>
Permalink:  ../20060720204752.51889.qmail@web31813.mail.mud.yahoo.com/
Also on:    postgresql.org/message-id/20060720204752.51889.qmail@web31813.mail.mud.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: rabroersma@yahoo.com, marchesini@unipg.it
  Subject: Re: simple problem???
  In-Reply-To: <20060720204752.51889.qmail@web31813.mail.mud.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox