Finding Recordset [message #356963] |
Mon, 03 November 2008 06:19  |
amalesh2008
Messages: 7 Registered: September 2008 Location: New York
|
Junior Member |
|
|
Hi,
Please give me the query to find out the following data :-
Scenario
I have 3 tables having the following structure
Account Owner Date
The data in the 3 tables is as follows :-
1st table 'TAB1'
Account Owner Date
Acc1 Ow1 03/11
Acc1 Ow2 03/11
Acc2 Ow4 03/11
Acc3 Ow6 03/11
2nd Table 'TAB2'
Account Owner Date
Acc1 Ow1 02/11
Acc1 Ow3 02/11
Acc2 Ow4 02/11
Acc3 Ow6 02/11
3rd Table 'TAB3'
Account Owner Date
Acc1 Ow1 01/11
Acc1 Ow2 01/11
Acc2 Ow5 01/11
Acc3 Ow6 02/11
Now, from the above data, I want to find all the records for all the accounts whose owners do not match.
e.g. For Acc1, on 03/11 and 01/11 owners are 'Ow1' and 'Ow2' whereas on 02/11 owners are 'Ow1' and 'Ow3'
Similarly, for Acc2, on 03/11 and 02/11 owner is 'Ow4' whereas on 01/11 owner is 'Ow5'
But, for Acc3, owner remains same on all the three dates.
So, Acc3 should not be returned in the query.
Please give the SQL query to solve this problem.
Thanks.
Amalesh
|
|
|
|
Re: Finding Recordset [message #356975 is a reply to message #356972] |
Mon, 03 November 2008 06:42   |
amalesh2008
Messages: 7 Registered: September 2008 Location: New York
|
Junior Member |
|
|
Hi Michel,
Thanks for such quick response.
However, I am not able to frame the query to find out the resultset.
Can you provide me with the query?
Thanks,
Amalesh
|
|
|
Re: Finding Recordset [message #356987 is a reply to message #356975] |
Mon, 03 November 2008 07:26  |
Olivia
Messages: 519 Registered: June 2008
|
Senior Member |
|
|
Use JOINS..
Quote: |
But, for Acc3, owner remains same on all the three dates.
|
Why you think that it is same in all table.In table 1 date is different.
Please post what you tried and if possible the test case.It would help to provide you what you are expecting.
Reagards,
Oli
|
|
|