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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting SQL:1999 format to ORACLE join format

Status
Not open for further replies.

rnooraei

Programmer
Apr 5, 2005
74
CA
Hi,
Could anybody convert this SQL syntax to Oracle format
Thanks

SELECT "COMPANY"."NAME" CompanyName, "EMPLOYEE"."LAST", "EMPLOYEE"."FIRST",
"PROJECT"."NAME" ProjectName, "PREFS"."ITEEMP", "TASK"."NAME" TaskName, "TRANS"."TOTAL",
"EMPLOYEE"."ID" EmpID, "PROJECT"."ID" ProID, "TASK"."ID" TaskID, "TRANS"."EMPRATE",
"TRANS"."PRORATE", "TRANS"."OTRATE", "TRANS"."EMPCOST", "PREFS"."ITEPRO",
"TRANS"."OTCOST", "TRANS"."DATE", "CLIENT"."ACR", "GROUP"."NAME" GroupName
FROM CLIENT INNER JOIN TRANS TRANS INNER JOIN TASK TASK ON TRANS.TASK = TASK.ID
INNER JOIN PROJECT PROJECT ON TRANS.PROJECT = PROJECT.ID
INNER JOIN EMPLOYEE EMPLOYEE ON TRANS.EMPLOYEE = EMPLOYEE.ID
INNER JOIN [GROUP] [GROUP] ON EMPLOYEE. [GROUP] = [GROUP].ID ON CLIENT.ID = PROJECT.CLIENT
CROSS JOIN PREFS
CROSS JOIN COMPANY
WHERE (TRANS.APPROVED = 'T') AND (TRANS.ERROR = 'F')
 
There's no Outer Join, so it's quite easy:

Remove any "INNER/CROSS JOIN" and replace it with "," and move any "ON join condition" into the WHERE clause.

SELECT ...
FROM
CLIENT,
TRANS,
TASK,
PROJECT,
EMPLOYEE,
"GROUP",
PREFS,
COMPANY
WHERE TRANS.TASK = TASK.ID
AND TRANS.PROJECT = PROJECT.ID
AND TRANS.EMPLOYEE = EMPLOYEE.ID
AND EMPLOYEE."GROUP" = "GROUP".ID
AND CLIENT.ID = PROJECT.CLIENT
AND (TRANS.APPROVED = 'T') AND (TRANS.ERROR = 'F')

Dieter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top