I'm using SQLite 3.39.3.
I came up with this query to check whether two tables have the same number of rows:
SELECT COUNT(a.auth_id)=COUNT(b.auth_scopus_id) FROM auth_subject_areas_mapping AS a, auth_subject_areas_mapping_old AS b;
But the query never finishes.
EXPLAIN QUERY PLAN
gives me:
Questions:
- What's wrong with my query?
- What is the correct way in SQLite to check whether two tables have the same number of rows?
CodePudding user response:
WITH
acount AS (SELECT count(*) AS a FROM auth_subject_areas_mapping),
bcount AS (SELECT count(*) AS b FROM auth_subject_areas_mapping_old)
SELECT a = b FROM acount, bcount;