Comparing two columns using SQL

If you have two tables which have columns with should contain the same data, and you want to check that the columns are the same, then it is possible compare the two columns using SQL.

If table1 has a column called users and table2 has a column called username, then to compare those two columns use something like :

SELECT users FROM table1 WHERE username NOT IN (SELECT username from table2)

Leave a Reply