Hey, I've been trying to get this working for awhile now and haven't come up with anything. Here's a picture representing the data to give you a better idea.
Table1
-----------
PK Index1 Index2
1 C D
2 C F
3 C H
Table2
-----------
PK Index1 Index2
1 C D
2 C S
What I'm trying to do is union these two tables on Index1. That would give 5 results. After that I want to check if any rows in Table2 have any Index2 values that match those in Table1. In this case, there is 1. If there is a match, then discard the row in Table1, keeping the row in Table2 leaving us with 4 results. I've tried using the UNION, INNER/LEFT/RIGHT JOIN, experimenting with many different combination's but can't seem to get it. Anyone have any ideas? I'm not sure if this is poor table design or I'm just missing something in my SQL statement. Thanks
Table1
-----------
PK Index1 Index2
1 C D
2 C F
3 C H
Table2
-----------
PK Index1 Index2
1 C D
2 C S
What I'm trying to do is union these two tables on Index1. That would give 5 results. After that I want to check if any rows in Table2 have any Index2 values that match those in Table1. In this case, there is 1. If there is a match, then discard the row in Table1, keeping the row in Table2 leaving us with 4 results. I've tried using the UNION, INNER/LEFT/RIGHT JOIN, experimenting with many different combination's but can't seem to get it. Anyone have any ideas? I'm not sure if this is poor table design or I'm just missing something in my SQL statement. Thanks