With PostgreSQL: I have a table named "people" with 4 columns: id, user_id, date_id, and status (which can have two values: "showed" "signup")
I'm looking to display 3 columns with a select query:
SELECT date_id, count(DISTINCT p.user_id) as people_attending, count(p.id) as people_registered
FROM people p
where (p.status::TEXT = 'showed') + MISSING PART HERE??
GROUP BY date_id
ORDER BY "date_id" ASC
Looking to get this:
date_id || people_attending || people_registered
12 || 100 || 230
34 || 10 || 12
Basically I'm trying to select one column (people_attending) where p.status = "showed" and then a third column (people_registered) where p.status = all cases. My first two columns are fine with the query above, however, the third column is an issue.
I'm having a difficult time finding a solution, reading Selecting same column twice from a single table but with different conditions and trying to do a self join.
Thanks for your help, MM.