VBA Express Forum  




Go Back   VBA Express Forum > VBA Code & Other Help > SQL
     Feedback     
Register FAQ Members Arcade Knowledge Base Training Articles Consulting

Reply
 
Thread Tools Display Modes
Old 04-17-2012, 05:21 AM   #1
BrianMH

 
Joined: Feb 2009
Posts: 481
Kb Entries: 1
Articles: 2
Oracle SQL

Hi,

I am looking for the best way to get the last record from multiple tables.

For instance 4 tables.

Customer indexed on customer_id
Accounts has customer_id and indexed on account_id
Orders has account_id and indexed on order_id
Items has order_id and indexed on item_id

The way the database is set up there are no fields that are common across all the tables. I cannot edit the database structure. What I want to do is get a customer based on the customer id and then the latest account, latest order and latest item from the tables.

Currently I am doing this by using with statments and getting a max from each table based on the preceding table. Is there a more efficient way of doing this?


-----------------------------------------
The more you learn about something the more you know you have much to learn.

Local Time: 08:12 PM
Local Date: 05-18-2013
Location:

 
Reply With Quote Top
Old 05-21-2012, 05:53 AM   #2
BrianMH

 
Joined: Feb 2009
Posts: 481
Kb Entries: 1
Articles: 2
Now cross posted to as no answer here.
http://www.dbforums.com/oracle/1679465-efficient-sql-retreiving-latest-row.html#post6552469


-----------------------------------------
The more you learn about something the more you know you have much to learn.

Local Time: 08:12 PM
Local Date: 05-18-2013
Location:

 
Reply With Quote Top
Reply



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
Forum Jump


All times are GMT -7. The time now is 01:12 PM.


Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright © 2004 - 2012 VBA Express