Peter Vidal wrote:
Hi list:

I am using the EXCSQLSTM command to execute SQL stuff within CL's. I am developing one today, as follows.

EXCSQLSTM SQLSTM('INSERT INTO WHCON/DUPITMWRK + (SELECT + ''TIM'' AS LOC, + ''MG'' AS ENV, + CASE + WHEN SUBSTR(ITNBR,1,1) = ''T'' THEN ITNBR + WHEN SUBSTR(ITNBR,1,1) <> ''T'' AND SUBSTR(ITNBR,15,1) = '' '' + THEN ''T''||SUBSTR(ITNBR,1,14) +
WHEN SUBSTR(ITNBR,15,1) <> '' '' THEN ITNBR + END AS ITEM + FROM ITMRVA WHERE SUBSTR(STID,1,1) = ''T'' + GROUP BY ITNBR ORDER BY ITNBR)')

Peter,

Whenever I've done grouping on a Select where there's a CASE statement, I've always restated the CASE statement in the Grouping and they've always worked. Try replacing the ITNBR with the CASE statement.

Bill

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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

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