Forum OpenACS Q&A: Response to Porting Oracle's (+) operator to pg.

Collapse
Posted by Jonathan Ellis on
the porting guide was written back in the bad old days of PG 6.

PG >= 7.0 supports the ANSI outer join syntax:

CREATE OR REPLACE VIEW n_sessions_day_user AS 
SELECT b.date_id, b.n_sessions_day, 
coalesce(a.n_users, 0) AS members, b.n_users AS non_members 
FROM visits_grouped b left outer join visits_grouped a  
on (b.n_sessions_day = a.n_sessions_day
    AND b.date_id = a.date_id
    AND 1 = a.member_p)
WHERE b.member_p = 0;