Re: Problem with SQL!!

From: Schmitz <Schmitz_at_rkhtcnw1.ngate.uni-regensburg.de>
Date: 1996/11/06
Message-ID: <3280DDC5.3E33_at_rkhtcnw1.ngate.uni-regensburg.de>#1/1


Simon Mercer wrote:

select min(column1), column2 from table group by column2;

Hans-Juergen Schmitz

>
> 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
  Received on Wed Nov 06 1996 - 00:00:00 CET

Original text of this message