× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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
me.

http://publib.boulder.ibm.com/infocenter/systems/topic/rzaq9/rzaq9.pdf

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
http://twitter.com/the_jamezp

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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

This mailing list archive is Copyright 1997-2024 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.