Hi guys!
I've got 2 tables, and I need to get some data between them.
test1:
test2:WITH account_status AS (selectCASEWHEN regdate = 1 THEN 'yes'WHEN regdate = 2 THEN 'no'from test1end as status_a)select status_a from account_status group by status_a
WITH user_status AS (selectCASEWHEN regdate = 1 THEN 'yes'WHEN regdate = 2 THEN 'no'from test1join test2 as t2 on t2.test1_id = t1.idend as status_a)select status_a from user_status group by status_a
It works fine.. but I would like to get that data in one single query.. How can I do that?
I'm using Postgres 9.3.
Thanks!
Patrick
Patrick