Re: selecting coordinates.

From: John Strange <jstrange_at_tpd.dsccc.com>
Date: 1995/06/07
Message-ID: <3r4nim$6vo_at_tpd.dsccc.com>#1/1


JE (eckley_at_capsrv.jhuapl.edu) wrote:
:> I have a simple query that I want to perform, but seem to be
:> out of it this week and cannot come up with it.
 

:> Assume a table (simplified) as follows:
 

:> coordinates
:> (
:> x integer,
:> y integer
:> )
 

:> If this table is populated with values like
 

:> 1,1
:> 1,2
:> 1,3
:> 1,4
:> 2,1
:> 2,2
:> 2,3
:> 2,4
:> 2,5
 

:> How can I use a single select statement to retrieve the following
:> results:
 

:> 1,5
:> 2,5
 

:> that is, all unique x coordinates paired with the highest corresponding
:> y coordinate?

select x, maxvalue(y)
from coordinates
group by x
/

--
This posting represents the personal opinions of the author. It is not the
official opinion or policy of the author's employer. Warranty expired when you
opened this article and I will not be responsible for its contents or use.
Received on Wed Jun 07 1995 - 00:00:00 CEST

Original text of this message