SQL语法问题(左连接)

cor*_*iKa 2 sql syntax left-join

所以我的查询有问题,我真的不明白在哪里.注释放在语法错误的位置.查询要大得多,我试图缩短它以进行有效但更整洁的查询.

这是使用odbc连接到Progress数据库.我被告知它使用严格的SQL-92.

SELECT itemcust."item-cust", 
       itemcust."cust-no", 
       corptreeCust.code 

FROM      pub."item-cust" itemcust 
JOIN      pub.customer cust 
left join pub.salesstructcustomer struct 
     on ( struct."corp-cust-type" = cust."corp-cust-type" 
      and struct."corp-cust-num" = cust."corp-cust-num" 
     ) 
left join pub.corptree corptreeCust 
      on ( corptreeCust.uid = struct.corptreeid /* program says SQL Syntax error here */
       and corptreeCust.category = 'store' 
      ) 

where ( itemcust."in-entity" = {$entity} or itemcust."in-entity" = '*') 
  and itemcust."item-no" = {$itemno} 
  and ( itemcust."cust-no" = {$custno} or itemcust."cust-no" = '*') 
  and cust."cust-no" = {$custno}
Run Code Online (Sandbox Code Playgroud)

谢谢!

Joe*_*lli 6

您的表别名pub.salesstructcustomerstruct,而不是structc在连接中引用.


Oni*_*ite 5

那是一个错字吗?看起来它正在看结构而不是结构,除非我错过了什么.