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!

Best way to get latest record from a query with multiple tables

DevguyMay 19 2016 — edited May 19 2016

Hi All,

I have a query which has 4 tables. I want to capture max record of a date column from 3 tables.

Eg:

SELECT 1

FROM parties_tbl a,

     location_tbl b,

     siteuses_tbl c

     contacts_tbl d

WHERE ----

and ---

;

All the above tables has who columns(creation_date,last_update_date,last_updated_by,last_updated_login). I want to capture the latest updated date if either parties_tbl or locations_tbl or contacts_tbl gets updated. For now, I am thinking I can use a union and capture individual max(last_update_date) inside a subquery and do a max outside of the union to get the latest updated date. But this might not be a better way in performance stand point.

Any suggestions are appreciated.

Thanks!

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 16 2016
Added on May 19 2016
9 comments
3,787 views