WITH table_name1 AS (
SELECT columns
FROM table1 t1
JOIN table2 t2
ON t1.col = t2.col
),
table_name2 AS (
SELECT columns
FROM table1 t1
JOIN table2 t2
ON t1.col = t2.col
)
SELECT columns
FROM table_name1 t1
JOIN table_name2 t2
ON t1.col - t2.col;
Was this page helpful?