Re: selecting coordinates.
From: Randy Dewoolfson <randyd_at_cais3.cais.com>
Date: 1995/06/07
Message-ID: <3r5cf0$8ut_at_news.cais.com>#1/1
Date: 1995/06/07
Message-ID: <3r5cf0$8ut_at_news.cais.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?
: thanks,
: JE
Let me wing this one...
SELECT x, max(y) FROM table GROUP BY x ORDER BY x;
Dont know for sure 'cause I'm not near an engine...
Good luck
Randy
-- ..uu. ---------------------- .?$" '?i . I Randy DeWoolfson I .T^M ._at_" d9 . f ,.un. b, i I--------------------I " Z :#" M `8 U < .dP"``"# `M _at_" I randyd_at_cais.com I &H?` Xl _R $5. $ ?* _at_ 'P,#" I--------------------I ,d#^*L :RP'~$b f`$L:M Xf .f' dH` I ,\//. I & 'M ,P `E M "$ Mux~ n!` I |o o| I dk `h" ' j " y" *~ I====oOO==(_)==Ooo===IReceived on Wed Jun 07 1995 - 00:00:00 CEST