i have to similar tables table 1 and table 2 .I want to compare the 2 tables and show the rows that ID is the same but has a different value in another column.
table 1
ID | ACTIVE |
---|---|
100 | 1 |
221 | 1 |
341 | 1 |
and
table 2
ID | ACTIVE |
---|---|
100 | 1 |
221 | 0 |
341 | 1 |
the output should be like this:
ID | ACTIVE |
---|---|
221 | 1 |
Advertisement
Answer
select t1.* from t1 join t2 on t1.id = t2.id where t1.active <> t2.active