I have multiple CTEs which all come from the same table, "table1". And all they return is a count of the rows. The differences between each CTE is the contents of the where statements as I want to compare the counts when I make these small changes. The code looks like:
WITH cte1 AS(
SELECT COUNT(*)
FROM table1
WHERE....
), cte2 AS(
SELECT COUNT(*)
FROM table1
WHERE....
), cte3 AS(
SELECT COUNT(*)
FROM table 1
WHERE....
)
I want to get an output where I get all the counts from each CTE and just have them in one table like:
cte1 cte2 cte3
1,564 3,567 2,861