Hi, I’m very new to redash, but I seem to keep running into issues with some queries I am trying to run.
I have a table of users and table of invited users. I am trying to create a graph for new users, broken down by invited users and non-invited users.
Example code below:
SELECT date_trunc(‘week’,a.created_at) AS week,
count(*) AS totalnew_signups,
sum(case when b.email is null then 1.0 else 0.0 end) as noninvited_signup,
sum(case when b.email is not null then 1.0 else 0.0 end) as invited_signup
FROM users a
LEFT JOIN
(SELECT DISTINCT email
FROM invited) b ON A.email=B.email
GROUP BY date_trunc(‘week’,a.created_at)
When I add the sum(Case when then end) condition the query just runs forever with no result. If I remove the the sum(case when then end) statements, I get results for the ‘totalnew_signups’ metric. The tables only have a few hundred rows. The db is postgreSQL 11.4.
What am I doing wrong here?
Thanks in advance!