Итак, у меня проблема с запросом, и я не совсем понимаю, где. Комментарий размещается там, где есть синтаксическая ошибка. Запрос намного больше, я попытался сократить его, чтобы сделать правильный, но аккуратный запрос.
Это использует 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}
Спасибо!