Outer Join Syntax - Mailing list pgsql-sql

From Richard Rowell
Subject Outer Join Syntax
Date
Msg-id 001f01c11abe$ebd29740$8301a8c0@RICHARD
Whole thread Raw
Responses Re: Outer Join Syntax
List pgsql-sql
I'm doing a feasability study on porting our flagship product to Postgres
(from MS_SQL).  I have run across a few snags, the largest of which is the
outer join syntax.  MS has some nice syntactical sugar with the *=/=*
operators that Postgres dosen't seem to support.  I am confused on how
to replicate the behavior however. We often link together many tables via
outer joins to form a view such as:
SELECT Assessment_medical_id, a.Readonly_agency, a.Date_added, ag.name as
'AgencyName',              y1.Yesno_descrip as 'healthprob', y2.Yesno_descrip as
'MentalIllness', y3.Yesno_descrip as 'MentalTreatment',              y4.Yesno_descrip as 'drugabuse',
d1.Drug_abuse_type_descrip
as 'drug1', d2.Drug_abuse_type_descrip as 'drug2',              d3.Drug_abuse_type_descrip as 'drug3',
d4.Drug_abuse_type_descrip as 'drug4', d5.Drug_abuse_type_descrip as
'drug5'              FROM ASSESSMENT_MEDICAL a, AGENCIES ag, YESNO_TYPES02 y1,
YESNO_TYPES02 y2, YESNO_TYPES02 y3, YESNO_TYPES02 y4,              DRUG_ABUSE_TYPES d1, DRUG_ABUSE_TYPES d2,
DRUG_ABUSE_TYPES
d3, DRUG_ABUSE_TYPES d4, DRUG_ABUSE_TYPES d5              WHERE a.inactive != 'Y'              AND a.Client_id =
$Edit_Client_id             AND a.Agency_creating *= ag.Agency_id              AND a.Health_prob *= y1.Yesno_code
      AND a.EmoMental_illness *= y2.Yesno_code              AND a.Treatment_for_emomental *= y3.Yesno_code
ANDa.AlchoholDrug_abuse *= y4.Yesno_code              AND a.AlchoholDrug_abuse_type1 *= d1.Drug_abuse_type_id
  AND a.AlchoholDrug_abuse_type2 *= d2.Drug_abuse_type_id              AND a.AlchoholDrug_abuse_type3 *=
d3.Drug_abuse_type_id             AND a.AlchoholDrug_abuse_type4 *= d4.Drug_abuse_type_id              AND
a.AlchoholDrug_abuse_type5*= d5.Drug_abuse_type_id
 


I'm just not grasping how one would accomplish the same using the SQL-92
syntax.

TIA






pgsql-sql by date:

Previous
From: "Michael Richards"
Date:
Subject: Re: Exclusion List
Next
From: "Joe Conway"
Date:
Subject: Re: Outer Join Syntax