DOMO-MYSQL转换数据库表错误

时间:2019-07-13 17:56:45

标签: mysql domo

我正在尝试从Microsoft帐户复制DOMO上的查询。我以为自己有正确的语法,但是现在我得到了。数据库报告了语法错误。不是唯一的表格/别名:“ ga_wip_due_within_one_week”

SELECT `egl_inv`.Category, `egl_inv`.StyleClass, `egl_inv`.StyleMaster,
  `egl_inv`.StyleMasterDesc, `egl_inv`.Color, `egl_inv`.ColorDesc, 
`egl_inv`.Size,`egl_inv`.GscSku, `egl_inv`.UPC, `egl_inv`.RedistributionFlag,
`egl_inv`.Date_Soldout, `egl_inv`.GGS, `egl_inv`.Core, `egl_inv`.CartonQty,
If(IsNull(`ga_inv`.SumOfQty=True),0,`ga_inv`.SumOfQty) AS GA_INV,
  If(IsNull(`ga_wip_due_within_one_week`.SumOfQty_Size_Open=True),
0,`ga_wip_due_within_one_week`.SumOfQty_Size_Open) AS GA_WIP,
If(IsNull(`ga_wip_due_within_one_week`.SumOfQty_Size_Open=True)
 ,0,`ga_wip_due_within_one_week`.`SumOfQty_Size_Open`.SumOfQty_Size) AS CUT,
If(IsNull(`averageweeklyfcst`=True),0,`averageweeklyfcst`) AS SS,
If(IsNull(`averageweeklyfcst`=True),0,`averageweeklyfcst`.`Demand`) AS 
Demand, If(IsNull(`openorder`.OpenOrders=True),0,`openorder`.OpenOrders) AS
OpenOrders, If(IsNull(`egl_inv`.SumOfQty=True),0,`egl_inv`.SumOfQty) AS
EGL_INV, 
If(IsNull(`averageweeklyfcst`.Demand=True),0,`averageweeklyfcst`.Demand) 
 AS AvgWklyFcst
FROM `averageweeklyfcst` 
RIGHT JOIN (OpenOrders RIGHT JOIN (((((`egl_inv`
LEFT JOIN `ga_inv`ON `egl_inv`.GscSku =     `ga_inv`.GscSku) 
 LEFT JOIN `ga_wip_due_within_one_week` ON `egl_inv`.GscSku =
`ga_wip_due_within_one_week`.GscSku) LEFT JOIN `ga_wip_due_within_one_week`
 ON `egl_inv`.GscSku = `ga_wip_due_within_one_week`.GscSku) 
 LEFT JOIN `averageweeklyfcst` ON `
egl_inv`.GscSku = `averageweeklyfcst`.GscSku) 
LEFT JOIN Demand ON `egl_inv`.GscSku = `averageweeklyfcst`.GscSku) ON 
`openorder`.GscSku = `egl_inv`.GscSku) ON 
`averageweeklyfcst`.GscSku = `egl_inv`.GscSku                
GROUP BY EGL_INV.Category, `egl_inv`.StyleClass, `egl_inv`.StyleMaster,
`egl_inv`.StyleMasterDesc, `egl_inv`.Color, `egl_inv`.ColorDesc,
`egl_inv`.Size, `egl_inv`.GscSku, `egl_inv`.UPC,
`egl_inv`.RedistributionFlag, `egl_inv`.Date_Soldout, `egl_inv`.GGS, 
`egl_inv`.Core, `egl_inv`.CartonQty,
If(IsNull(`ga_inv`.SumOfQty]=True),0,`ga_inv`.SumOfQty),
If(IsNull(`ga_wip_due_within_one_week`.SumOfQty_Size_Open=True),
0,`ga_wip_due_within_one_week`..SumOfQty_Size_Open),
If(IsNull(`ga_wip_due_within_one_week`.SumOfQty_Size_Open=True)
,0,`ga_wip_due_within_one_week`.SumOfQty_Size), 
If(IsNull(`averageweeklyfcst`=True),0,`averageweeklyfcst`), 
If(IsNull(`averageweeklyfcst`.Demand=True),0,`averageweeklyfcst`), 
If(IsNull(`openorder`.OpenOrders=True),0,`openorder`.OpenOrders), 
If(IsNull(`egl_inv`.`SumOfQty`=True),0,`egl_inv`.`SumOfQty`), 
If(IsNull(`averageweeklyfcst`.Demand=True),0,`averageweeklyfcst`.`Demand`);

数据库报告语法错误。不是唯一的表格/别名:“ ga_wip_due_within_one_week”

1 个答案:

答案 0 :(得分:0)

您在下一行的中间

 LEFT JOIN `ga_wip_due_within_one_week` ON `egl_inv`.GscSku =
`ga_wip_due_within_one_week`.GscSku) LEFT JOIN `ga_wip_due_within_one_week` 

如您所见,您在第二个广告中都添加了没有别名的内容,例如     ga_wip_due_within_one_week_1