我有这个问题,我正试图逐字逐句地转换自己:
SELECT "Job_Operation"."Work_Center",
"Job_Operation"."Job_Operation",
"Job_Operation_Time"."Work_Date",
"Job_Operation"."Est_Total_Hrs"."Job_Operation_Time"."Act_Run_Hrs",
"Job_Operation_Time"."Act_Setup_Hrs",
"Job",
"Job"."Description",
"Job_Operation_Time"."Overtime_Hrs"."Job_Operation_Time"."Act_Setup_Hrs",
"Job"."Job",
"Job"."Description",
"Job_Operation_Time"."Labor_Burden",
"Job_Operation"."Est_Setup_Labor",
"Job_Operation"."Est_Run_Labor",
"Job_Operation"."Est_Labor_Burden"."Job_Operation"."Operation_Service"
FROM {oj("Job" "Job"
LEFT OUTER JOIN "Job_Operation" "Job_Operation"
ON "Job"."Job"="Job_Operation"."Job")
LEFT OUT JOIN "Job_Operation_Time" "Job_Operation_Time"
ON "Job_Operation"."Job_Operation"."Job_Operation"="Job_Operation_Time"."Job_Operation"}
这就是我为MySql提出的:
SELECT Job_Operation.Work_Center,
Job_Operation.Job_Operation,
Job_Operation_Time.Work_Date,
Job_Operation.Est_Total_Hrs.Job_Operation_Time.Act_Run_Hrs,
Job_Operation_Time.Act_Setup_Hrs,
Job,
Job.Description,
Job_Operation_Time.Overtime_Hrs.Job_Operation_Time.Act_Setup_Hrs,
Job.Job,
Job.Description,
Job_Operation_Time.Labor_Burden,
Job_Operation.Est_Setup_Labor,
Job_Operation.Est_Run_Labor,
Job_Operation.Est_Labor_Burden.Job_Operation.Operation_Service
FROM LEFT JOIN (Job LEFT JOIN Job_Operation ON Job.Job=Job_Operation.Job)
LEFT JOIN Job_Operation_Time Job_Operation_Time
ON Job_Operation.Job_Operation.Job_Operation=Job_Operation_Time.Job_Operation
但它显然不起作用。我哪里错了?有没有一个简单的工具来帮助这种事情?经过进一步调查,我意识到这是一个CRYSTAL REPORT QUERY,因为它不能在我的SQL服务器上工作。
答案 0 :(得分:1)
在这里采取刺:
SELECT "Job_Operation"."Work_Center"
,"Job_Operation"."Job_Operation"
,"Job_Operation_Time"."Work_Date"
,"Job_Operation"."Est_Total_Hrs"
,"Job_Operation_Time"."Act_Run_Hrs"
,"Job_Operation_Time"."Act_Setup_Hrs"
,"Job"."Description"
,"Job_Operation_Time"."Overtime_Hrs"
,"Job_Operation_Time"."Act_Setup_Hrs"
,"Job"."Job"
,"Job_Operation_Time"."Labor_Burden"
,"Job_Operation"."Est_Setup_Labor"
,"Job_Operation"."Est_Run_Labor"
,"Job_Operation"."Est_Labor_Burden"
,"Job_Operation"."Operation_Service"
FROM "Job" AS "Job"
LEFT OUTER JOIN "Job_Operation" AS "Job_Operation" ON "Job"."Job" = "Job_Operation"."Job"
LEFT OUTER JOIN "Job_Operation_Time" AS "Job_Operation_Time" ON "Job_Operation"."Job_Operation" = "Job_Operation_Time"."Job_Operation"
我删除了尴尬的“某处这是专有的”语法,修复了几个应该是逗号的句点,将OUT
更改为OUTER
,并为表别名提供了AS
语句。这应该符合ANSI标准,希望这会有所帮助。
修改强>
通过用引号括起来更新我的答案以逃避所有保留字。同时取消了Job.Description
的双重选择。