SQL – how to distinguish between two tables
•
Android
I have two tables. I want to get all records from one table that are different from those in the second table
For example, if we have four records in the first table, such as a, B, C and D, and three records of a, B and C in the second table, the answer to the query should be d
I tried the "excel" operator, but it doesn't work properly. Please help me write the correct query for the given problem
resolvent:
how:
select * from TABLE_A where (COL,COL2,..) not in (select COL1,COL2,.. from TABLE_B)
union all
select * from TABLE_B where (COL1,COL2,..) not in (select COL1,COL2,.. from TABLE_A);
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码