Re: Problem with SQL!!

From: Slava Natapov <Slava_Natapov_at_mail.stil.scitex.com>
Date: 1996/11/07
Message-ID: <32821A78.37BA_at_mail.stil.scitex.com>#1/1


Simon Mercer wrote:
>
> Dear All,
>
> It's before coffee break and so this may be a stupid question, but
> I have a table with something like the following values;
>
> column1 | column2
> 0 100
> 1 100
> 2 100
> 3 200
> 4 200
>
> - where column1 is the primary key.
>
> All I want to get is, for each value in column2, the lowest value
> in column1;
>
> 0 | 100
> 3 | 200
>
> I know I could use a procedural language to get the result, but SQL must
> surely be able to do this - it looks so simple!
>
> Any suggestions? Please mail me a copy because I might miss it in the
> newsgroup.
>
> Thanks,
>
> Simon
>
> --
> Dr. Simon Mercer
> Ressourcenzentrum des Deutschen Genomprojekts
> +49 30 326 39111 (fax)
> mailto:mercer_at_rzpd.de

Do you mean this ?

  SELECT MIN(column1),column2
  FROM table
  GROUP BY column2; Received on Thu Nov 07 1996 - 00:00:00 CET

Original text of this message