I am trying to use a UNION to append the total column in the first top half to the second half of the query.
SELECT NULL as month, NULL as active, count(cage_player_id) as total
FROM player_signup as p
GROUP BY date_part('month', p.signup_date)
UNION
SELECT date_part('month', signup_date) as month, count(DISTINCT(p.cage_player_id)) as active, NULL as total
FROM player_signup as p
JOIN daily_kpis as d ON p.cage_player_id = d.cage_player_id
WHERE slot_bet_amount > 0
OR ld_bet_amount > 0
OR table_bet_amount > 0
GROUP BY date_part('month', p.signup_date)
ORDER BY date_part('month', p.signup_date) ASC
I keep getting an error that says the FROM clause is missing for table p. Can anyone help? Is there an easier way to combine these two queries?
Here is what each query looks like separately. I just want to add the total column right next to the month and active column. The total ID's would still be broken down by months.
Query 1

Query 2
