I want to merge two tables and subtract the number of orders in resulting table from left join from the resulting table in inner join. This is what I have done but I do not know if this is correct or how to proceed?
WITH t1 AS (
SELECT *
FROM orders
LEFT JOIN food ON orders.id = food.id
),
t2 AS (
SELECT *
FROM orders
INNER JOIN food ON orders.id = food.id
)
SELECT
/* now what? */
Now I want to subtract number of rows in two tables.
I do not know how to proceed, should I join tables again and do subtraction, is there an easier way?