All,
What is the best or recommended approach for check to see if values are present in one or more different database tables? With one key element, I believe anyway and that is there may be some items based on certain criteria that are in both.
For instance, I have database TEST with table TESTA with columns of ID, DATEPROCESSED, TYPE. I have database MYTEST with a table MYTESTB where I have colums (ID, DATEUTILIZED, TYPE). NOTE: The DATEPROCESS and DATEUTILIZED are essentially representing the same thing just the databases are using different column name terminology.
Now, I may have the following example:
TEST
TESTA
1 2/10/2010 B
2 12/31/2009 C
3 2/15/2010 B
MYTEST
MYTESTA
1 1/10/2010 B
2 12/31/2009 C
3 4/15/2010 B
Now, I have something I need to check to see if it is a duplicate or already exists. And I have values, 1, 1/10/2009, B.
You see that it doesn't exist in TEST.TESTA but it does exist in MYTEST.MYTESTA. So, if I search I would expect it to show it being a duplicate.
Next I would have values of 2, 12/31/2009, C. That exists in TEST.TESTA and MYTEST.MYTESTA. So, if I search I expect it would show it being a duplicate.
Next, I have 2, 7/24/2010, B. If I searxch I expect it would not show as a duplicate.
What is the best manner or approach?
Create a temporary table and select from TEST.TESTA for a finding and MYTEST.MYTESTA for a find then if the temporary table has any rows then I know there is a duplicate and if not then I know it's not?
Or is there another way?
Any inform would be greatly appreciated.
Thanks
What is the best or recommended approach for check to see if values are present in one or more different database tables? With one key element, I believe anyway and that is there may be some items based on certain criteria that are in both.
For instance, I have database TEST with table TESTA with columns of ID, DATEPROCESSED, TYPE. I have database MYTEST with a table MYTESTB where I have colums (ID, DATEUTILIZED, TYPE). NOTE: The DATEPROCESS and DATEUTILIZED are essentially representing the same thing just the databases are using different column name terminology.
Now, I may have the following example:
TEST
TESTA
1 2/10/2010 B
2 12/31/2009 C
3 2/15/2010 B
MYTEST
MYTESTA
1 1/10/2010 B
2 12/31/2009 C
3 4/15/2010 B
Now, I have something I need to check to see if it is a duplicate or already exists. And I have values, 1, 1/10/2009, B.
You see that it doesn't exist in TEST.TESTA but it does exist in MYTEST.MYTESTA. So, if I search I would expect it to show it being a duplicate.
Next I would have values of 2, 12/31/2009, C. That exists in TEST.TESTA and MYTEST.MYTESTA. So, if I search I expect it would show it being a duplicate.
Next, I have 2, 7/24/2010, B. If I searxch I expect it would not show as a duplicate.
What is the best manner or approach?
Create a temporary table and select from TEST.TESTA for a finding and MYTEST.MYTESTA for a find then if the temporary table has any rows then I know there is a duplicate and if not then I know it's not?
Or is there another way?
Any inform would be greatly appreciated.
Thanks