Can I ask you to help me convert this {oj } SQL syntax to normal join syntax?
SELECT ... FROM {oj (((((((((("VMPH" "VMPH" LEFT OUTER JOIN "VMPT" "VMPT" ON "VMPH"."NMPSTID"="VMPT"."NMPSTID") LEFT OUTER JOIN "ARRTA" "ARRTA" ON "VMPH"."TXTERM"="ARRTA"."CODETERM") LEFT OUTER JOIN "VMAGRE" "VMAGRE" ON "VMPH"."NMAGRE"="VMAGRE"."NMDOCID") LEFT OUTER JOIN "VMDH" "VMDH" ON "VMPH"."NMDOCID"="VMDH"."NMDOCID") LEFT OUTER JOIN "VMPTIT" "VMPTIT" ON ("VMPT"."NMPSTID"="VMPTIT"."NMPSTID") AND ("VMPT"."WDTRANNUM"="VMPTIT"."WDTRANNUM")) LEFT OUTER JOIN "VMPTSV" "VMPTSV" ON ("VMPT"."NMPSTID"="VMPTSV"."NMPSTID") AND ("VMPT"."WDTRANNUM"="VMPTSV"."WDTRANNUM")) LEFT OUTER JOIN "VMPTEQ" "VMPTEQ" ON ("VMPT"."NMPSTID"="VMPTEQ"."NMPSTID") AND ("VMPT"."WDTRANNUM"="VMPTEQ"."WDTRANNUM")) LEFT OUTER JOIN "VMDTEQ" "VMDTEQ" ON ("VMPT"."NMDOCID"="VMDTEQ"."NMDOCID") AND ("VMPT"."WDDTTRNUM"="VMDTEQ"."WDTRANNUM")) LEFT OUTER JOIN "VMMTRM" "VMMTRM" ON ("VMPTEQ"."TXEQUP"="VMMTRM"."TXEQUP") AND ("VMPTEQ"."TXMETER"="VMMTRM"."TXMETER")) LEFT OUTER JOIN "VMEQUP" "VMEQUP" ON ("VMPTEQ"."TXEQUP"="VMEQUP"."TXEQUP")) LEFT OUTER JOIN "VMSERV" "VMSERV" ON ("VMPTSV"."WDSERVTYPE"="VMSERV"."WDTYPE") AND ("VMPTSV"."TXSERV"="VMSERV"."TXSERV")}
I tried removing the brackets and "oj" but it doesn't work. I tried the following but it didn't work well
SELECT ... WHERE "VMPH"."NMPSTID" = "VMPT"."NMPSTID" AND "VMPH"."TXTERM" = "ARRTA"."CODETERM" AND "VMPH"."NMAGRE" = "VMAGRE"."NMDOCID" AND "VMPH"."NMDOCID" = "VMDH"."NMDOCID" AND (("VMPT"."NMPSTID" = "VMPTIT"."NMPSTID") AND ("VMPT"."WDTRANNUM" = "VMPTIT"."WDTRANNUM")) AND (("VMPT"."NMPSTID" = "VMPTSV"."NMPSTID") AND ("VMPT"."WDTRANNUM" = "VMPTSV"."WDTRANNUM")) AND (("VMPT"."NMPSTID"="VMPTEQ"."NMPSTID") AND ("VMPT"."WDTRANNUM"="VMPTEQ"."WDTRANNUM")) AND (("VMPT"."NMDOCID"="VMDTEQ"."NMDOCID") AND ("VMPT"."WDDTTRNUM"="VMDTEQ"."WDTRANNUM")) AND (("VMPTEQ"."TXEQUP"="VMMTRM"."TXEQUP") AND ("VMPTEQ"."TXMETER"="VMMTRM"."TXMETER")) AND "VMPTEQ"."TXEQUP" = "VMEQUP"."TXEQUP" AND (("VMPTSV"."WDSERVTYPE"="VMSERV"."WDTYPE") AND ("VMPTSV"."TXSERV"="VMSERV"."TXSERV"))
In mysql, if the identifier (i.e. table name, column name) is a reserved word, it must be enclosed in backticks, and your identifier is not, so the double quotes may be lost. Also the aliases assigned by oj (whatever that is) aren't particularly useful, so I'll lose those aliases and parentheses. For example
Any question? Add all table definitions.