I have two SQLite tables I want to compare. To set up the tables:
CREATE TABLE A (Value);
CREATE TABLE B (Value);
INSERT INTO A VALUES (1);
INSERT INTO A VALUES (1);
INSERT INTO B VALUES (2);
INSERT INTO B VALUES (1);
The closest I got with comparing two tables is using the SQL below:
SELECT 'A' AS Diff, *
FROM (SELECT * FROM A EXCEPT SELECT * FROM B)
UNION ALL
SELECT 'B' AS Diff, *
FROM (SELECT * FROM B EXCEPT SELECT * FROM A)
The result I want is
A; 1
B; 2
However, I only get
B; 2
because the EXCEPT keyword removes all 1's coming from Table A regardless of how many 1's there are in Table B.
How should I be comparing the two tables?