Good Morning.
How would one go about creating a SQL query that will compare values in 3 tables and then return the AccountNumber and the tablename that the AccountNumber is in?
I'm trying to come up with a solution where the result lists the AccountNumbers and table name(s) that the AccountNumber appears in.....
Can you post some DDL statements and what you have put together so far? I am not entirely sure of what you need. Is it a LEFT JOIN on the AccountNumber across the three tables or no JOIN at all but just to see if the AccountNumber exists in general?
James, I am actually importing data from csv files. Here's what I have so far, I found this when i was researching...but i still can't figure out how to get the table names to display...
select AccountNumber
from (
select '1' as tableName, AccountNumber
from BPMVendors
union
select '2', AccountNumber
from DataDescription
union
select '3', AccountNumber
from Portfolios
) as ResultTable
group
by AccountNumber
having count(*) < 3