June 13, 2011 at 10:57 pm
Dear All,
I have 3 tables having some 10 fields of each i need to compare the each column with another 4th table to check whether these records are exist or not in these 3 tables.
We don't have any primary key as in the 4th table to match to make join.
Let me know how do we do this,
Thanks,
Gangadhar
June 13, 2011 at 11:38 pm
Without DDL and example data I can give only a generic answer. But something like
select t1.*
from t1 left join t2 on (t1.f1 = t2.f1 and t1.f2 = t2.f2 ...)
where t2.f1 is null
should give you rows in t1 which are not present in t2
(assuming t2.f1 is never null if the t2 row is present)
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
June 13, 2011 at 11:39 pm
Start by reading the first article I reference below in my signature block regarding asking for help and then follow the adive in the article. We need the table structures of the tables (CREATE TABLE statements), sample data for each of the tables (a series of INSERT INTO statements for each table) with enough data to represent the problem domain (no more than 10 records should do it), the expected results based on the sample data, and what you have coded so far in an attempt to solve your problem.
If you provide all this information, you will help from numerous people and in return for your efforts, you will also get back tested code.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply