Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQl to return rows based on max value of a column

880665Feb 23 2017 — edited Feb 24 2017

Hello

I have a transaction table with 300 million rows and the grain is ID,Version

One ID can have multiple versions.

     

IDNAMEVERSIONSTART_DATEEND_DATE
1A12/1/20172/10/2017
1A22/1/20172/10/2017
1A32/1/20172/10/2017
2B12/4/20172/14/2017
2NULL22/4/20172/14/2017
2B32/4/20172/14/2017

I am trying to retrieve unique rows from the transaction table based on the ID & max(version) of the row.

My output looks like

     

IDNAMEVERSIONSTART_DATEEND_DATE
1A32/1/20172/10/2017
2B32/4/20172/14/2017

Given I need to query a  300 million row table, which can grow fast, Can you suggest any approaches to retrieve unique rows ?

Thank you again

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 24 2017
Added on Feb 23 2017
14 comments
4,208 views