I am trying to use a CTE to generate a data table for a unit test in SQL (postgresql).
WITH temp1 AS (
SELECT
('A', 'A', 'B', 'B') AS grp,
(1, 2, NULL, 1) AS outcome
)
SELECT *
FROM temp1
The above query is generating a single row rather than a 4-row table that would be useful to my unit test. How can I generate the 4-row table in the form:
grp.....outcome
A.......1
A.......2
B.......NULL
B.......1