This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
Hi ranchers I have one question to ask Let me describe the situation:
There are 3 tables which I need to joint on a single field CALLED AS ID
Now in each table there is a field called as Updt_Timestamp.
Now the problem statement is
Select the record for that particular ID (Which is given ofcourse) from the 3 tables but finally there should be a single record with the latest Updt_Timestamp among those 3 records.
Now I know one method which is, first take all the records in three cursur and then compare there timestamps and then create a flag which will indicate us that from which cursor we are finally taking the record.......
Isn't there any appropriate method.
Because in this flow we are using 3 cursors which are not finally usable only one of them is going to be used.
But that I know already but as you can see that there is a multiple hit on Database which is not good for performance tuning.....
The method, earlier I explained is the other way and also prevent multiple hitting the Database I need some more better Query.
I agree with Stu as I think the best approach is to use two queries. "multiple hit on Database which is not good for performance tuning". This isn't always true. I've seen really complex queries that took longer because the database had to do so much extra work to avoid doing a separate query.
If you are concerned about network traffic, you can do the two queries in a stored procedure.
So what do you think about my methodology what I have stated there in my earlier threads. If I write this whole code in Stored Procedures. Then which will be the best option for this sort of operations..