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!

Get latest record among multiple tables

User_K6LH0Jun 6 2014 — edited Jun 9 2014

Hello Guys,

I would really appreciate if you could help me in figuring out a solution to this problem I am facing:

We are on Oracle 11g Release 2.

Say, I have 3 tables A, B and C, all the 3 tables have the following columns with the exact same names:

data_load_time DATE

data_load_process VARCHAR2(100)

data_update_time DATE

data_update_process VARCHAR2(100)

And, also a foreign key - fkey NUMBER.

Now the requirement is - for a given fkey (say 100), I need to pull the latest time and process among the 3 tables, it doesn't matter whether

it's load or update columns, I just need 1 set of values, the max time and the corresponding process out.

Eg: Say for fkey = 100, I get the max time and the corresponding process from table A, then I get the max time and corresponding process from table B and then from table C, the final result should have the max time and the corresponding process out of the 3 values I just pulled out from the 3 tables separately.

Is there a efficient way of accomplishing this in just 1 query ?.

Thanks for your help.

-D

This post has been answered by Ramin Hashimzadeh on Jun 7 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 7 2014
Added on Jun 6 2014
5 comments
536 views