I want to calculate the difference between the results of 2 count(*)-type SELECT queries executed on 2 separate tables of my PostgreSQL database.
count(*)
This w
Another option is to use SUM:
SUM
SELECT SUM(val) AS result FROM (SELECT count(*) AS val FROM tab2 UNION ALL SELECT -count(*) FROM tab1) sub;
db<>fiddle demo