Hello All,
I am getting this error (SQL0338) on 6.1. I found documentation about this
error, but I don't really understand why so I'm hoping an SQL guru can help


Here is the SQL statement. It works fine on 5.4, but not on 6.1. If i keep
move the "USERS" table to be after the JOIN clause all works okay.

WITH temp(company_id, item_number) AS (
SELECT cmp, item
FROM mylib.itembal
GROUP BY cmp, item
SELECT vendor, vendor_name, COUNT(a.item_number)
FROM mylib.vendor_items AS a,mylib.users AS b
JOIN temp AS t ON a.item_number = t.item_number AND
a.company_id = t.company_id
WHERE userid = ? AND a.web_site_id = b.web_site_id AND
a.company_id = 1
GROUP BY vendor, vendor_name
ORDER BY vendor_name

I'm sure this is how it's supposed to work, but I don't really understand
why. Is this standard SQL behavior?

Thanks in advance,
James R. Perkins

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].