Re: SQL UNION Question (or not UNION?)



Whatever the answer is it's going to require more than a simple query. You
can do it in code or you could possibly use temp tables to massage the data
to boil it down to what you want. In order to get a specific answer you
need to define how to handle the cross-table duplicates.

I'm trying to boil down the data because each table contains the name,
but also some additional information. The information is similar, but
not exactly the same. In short, I'd like to know which table it came
from so I know what extra information I can grab later. I think a
return of "1", "2" or "both" would suffice....

I'm thinking that a nested loop is going to be the fastest (never
thought I'd say that). I can get the rows from table 1, then loop each
one and see if they exist are in table 2. I could concatenate the
extras and note the dups as "both".

.


Loading