Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL question - need to select only one row of a group-by result set?

Re: SQL question - need to select only one row of a group-by result set?

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Tue, 09 Feb 1999 03:21:53 GMT
Message-ID: <36c3a97e.9362883@192.86.155.100>


A copy of this was sent to David Van Zandt <dvanzandt_at_iquest.net> (if that email address didn't require changing) On Mon, 08 Feb 1999 22:14:23 -0500, you wrote:

>Hi all, and yes, I've been reading TFM for two days now. Just in case
>I'm beating my head neadlessly, I'm asking for help parsing a SQL query.
>
>Seems simple enough: the need is to query one table, returning such
>columns as a product_key, date last updated, and time last updated. I
>obviously need to use GROUP-BY in order to utilize the MAX function, but
>my queries generate all of the rows that fulfill the group-by
>constraints -- not just the one maximum-value row.
>

group by's aren't constraints.... a where or having clause would filter rows but not a group by...

we would need to see a table definition, representative data, and the expected result set you would want...

>I've played with rownum, only to find it's relative to the result set.
>I'd have to save an intermediate table, then do a second query to obtain
>it that way.
>
>Am I missing something basic? I'm stumped, and would welcome your
>suggestions. TIA.
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA

--
http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Mon Feb 08 1999 - 21:21:53 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US