dbTalk Databases Forums  

analytic function

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss analytic function in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Billou
 
Posts: n/a

Default analytic function - 06-23-2006 , 01:08 AM






Hi,

using a select like:

select max(date) over (partition by...)

how can I retrieve a value from the same row than the max(date) ?
For example, how can I find the price value for the max(date) over that
partition ?

thank you



Reply With Quote
  #2  
Old   
sim
 
Posts: n/a

Default Re: analytic function - 07-20-2006 , 06:36 AM







Billou schrieb:

Quote:
Hi,

using a select like:

select max(date) over (partition by...)

how can I retrieve a value from the same row than the max(date) ?
For example, how can I find the price value for the max(date) over that
partition ?

thank you
You could select not only the max(date) but also the key of the record
with max(date) using a group by and then join it with the table.
Something like this:

select a.price
from
your_table a,
(
select key
max(date)
from your_table
) b
where a.key = b.key

Regards,

Jörg



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.