Ändern Sie die SQL-Abfrage {oj } in die normale SQL-Syntax
P粉030479054
P粉030479054 2023-09-07 00:20:45
0
1
659

Darf ich Sie bitten, mir bei der Konvertierung dieser {oj }-SQL-Syntax in die normale Join-Syntax zu helfen?

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")}

Ich habe versucht, die Klammern und „oj“ zu entfernen, aber es funktioniert nicht. Ich habe Folgendes versucht, aber es hat nicht gut funktioniert

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"))

P粉030479054
P粉030479054

Antworte allen(1)
P粉662089521

在 mysql 中,如果标识符(即表名、列名)是保留字,则必须用反引号括起来,而您的标识符都不是,因此可能会丢失双引号。另外 oj (无论是什么)分配的别名并不是特别有用,所以我会丢失这些别名和括号。例如

SELECT *
FROM  VMPH  
 LEFT OUTER JOIN VMPT  ON VMPH.NMPSTID=VMPT.NMPSTID
 LEFT OUTER JOIN ARRTA ON VMPH.TXTERM=ARRTA.CODETERM
 LEFT OUTER JOIN VMAGRE ON VMPH.NMAGRE=VMAGRE.NMDOCID
 LEFT OUTER JOIN VMDH  ON VMPH.NMDOCID=VMDH.NMDOCID
 LEFT OUTER JOIN VMPTIT ON VMPT.NMPSTID=VMPTIT.NMPSTID AND VMPT.WDTRANNUM=VMPTIT.WDTRANNUM
 LEFT OUTER JOIN VMPTSV ON VMPT.NMPSTID=VMPTSV.NMPSTID AND VMPT.WDTRANNUM=VMPTSV.WDTRANNUM
 LEFT OUTER JOIN VMPTEQ ON VMPT.NMPSTID=VMPTEQ.NMPSTID AND VMPT.WDTRANNUM=VMPTEQ.WDTRANNUM
 LEFT OUTER JOIN VMDTEQ ON VMPT.NMDOCID=VMDTEQ.NMDOCID AND VMPT.WDDTTRNUM=VMDTEQ.WDTRANNUM
 LEFT OUTER JOIN VMMTRM ON VMPTEQ.TXEQUP=VMMTRM.TXEQUP AND VMPTEQ.TXMETER=VMMTRM.TXMETER
 LEFT OUTER JOIN VMEQUP ON VMPTEQ.TXEQUP=VMEQUP.TXEQUP
 LEFT OUTER JOIN VMSERV ON VMPTSV.WDSERVTYPE=VMSERV.WDTYPE AND VMPTSV.TXSERV=VMSERV.TXSERV;

还有问题吗?添加所有表定义。

Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage