Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i convert this to ANSI/Postgres usable SQL?

Status
Not open for further replies.

wolfspawn

Programmer
Jan 17, 2003
3
US

here is an example of the end of a SQL statement that I need to convert. the SELECT clause is irrelevant (it was just too much to post).

i am kind of lost on what to do with the outer joins that i have on a table to a particular field for example ---- fax.gctyp(+)='FX'



-----

FROM
gnams gnamsOffices,
offices offices,
offmls offmls,
phones phone,
phones fax,
Addresses addresses,
gnams gnamsMgr,
phones mgrPhone,
phones asstMgrPhone
WHERE
gnamsOffices.namid=offices.namid AND
offices.namid=phone.namid(+) AND
offices.namid=fax.namid(+) AND
offices.namid=addresses.namid(+) AND
offices.OffCo > 0 AND
offices.offco=offmls.offco(+) AND
offices.offno=offmls.offno(+) AND
gnamsOffices.NamTyp='IO' AND
phone.gctyp(+)='PH' AND
(phone.publish='y' OR phone.publish='Y' or phone.publish is null) AND
fax.gctyp(+)='FX' AND
addresses.GCCode='BUS' AND
mgrPhone.gctyp(+)='PH' AND
asstMgrPhone.gctyp(+)='PH' AND
offices.Prod_Admin='P' AND
offices.status='A' AND
offices.mngr_nameid=gnamsMgr.namid(+) AND
offices.mngr_nameid=mgrPhone.namid(+) AND
offices.asst_mngr_namid=asstMgrPhone.namid(+) AND
offices.SHOW_ON_ROSTER='Y' AND
mgrPhone.gccode(+)='201' AND
asstMgrPhone.gccode(+)='201' AND
offices.offno IN(SELECT offno FROM offcnty WHERE cnty_id=4)
ORDER BY officeName,offNo,ph_conseq,fx_conseq,mngr_conseq



-----

i am trying to write a converter to do this for all of my code, i am just unsure how to do some of this in a processable, efficient way

thanks... travis

 
I am assuming fax.gctyp(+)='FX' means
table fax, column gcptyp outer join with a fixed value called 'FX'

normally outer joins are done with the following syntax

select ab,bc,de, from table1 full outer join on table2.colname = table1.colname1

you can also use left outer join or right join
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top