I have 2 tables in database: table_1 and table_2.
table_1 contains 3 column namely a_id, a_zone, a_address
table_2 contains 4 column namely p_id, not_use, p_zone, p_address
The row numbers are not same in the 2 tables. I need to compare the “DATA SET” of the (a_zone, a_address) from table_1 with (p_zone, p_address) from table_2.
Let me give you an example:
Table1 contains:
a_zone a_address
=================
1 8
2 9
3 6
4 9
5 2
Table2 contains:
p_zone p_address
=================
1 8
2 9
3 6
4 9
5 8
Now I need to compare like this a_zone, a_address = p_zone, p_address or not.
I do not need to compare only a_zone with only p_zone or only a_address with only p_address. Rather, I need to compare the whole data combination. for my above example, I need to compare 18 with 18 [a_zone,a_address WITH p_zone, p_address ]
I’m stuck with it, and really need help. Please suggest me….:)
You haven’t specified what data you wish to return so I have assumed a simple join.
Unless I am mis understandng your query I do not think that you need a union I think that you can do this with a single join:
This returns: