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



Dear All,

I' m asking your opinion about the following behavior.

First SQL
The follow sql does not work. It's return SQL0122 error "Column *N or expression in select is not valid"

Select 'K' AS TIPO , 1 AS PERIODO , TTBACK CONCAT TTBDCK AS ELEMENTO1
, TTBPCK AS ELEMENTO2 , count(*) AS QUANTITA ,
IFNULL((Select COUNT(*) FROM SNVEI0F INNER JOIN IBM_DAT/SNCON0F
ON B5CSCK = BNCSCK INNER JOIN IBM_DAT/SNSLL0F ON B5BACK = IMBACK
and IMKDCK = 'DV1' INNER JOIN IBM_DAT/SNSLR0F ON
IMKDCK = N2KDCK and IMCCKK = N2CCKK WHERE B5BACK CONCAT
B5BDCK = TTBACK CONCAT TTBDCK AND B5BPCK = TTBPCK AND
B5CFDT <= 1230131 AND B5CWDT > 1230131 AND B5CFDT <> 0 AND B5BWST
IN ('D') AND B5JDST in (' ' , 'H') AND B5BACK IN ('A01')
) , 0) AS QUANTITAORDINI ,
0 AS QUANTITALIBERA FROM IBM_DAT/SNCID0F INNER JOIN
IBM_DAT/SNCON0F ON TTCSCK = BNCSCK INNER JOIN IBM_DAT/SNSLL0F
ON TTBACK = IMBACK and IMKDCK = 'DV1' INNER JOIN IBM_DAT/SNSLR0F
ON IMKDCK = N2KDCK and IMCCKK = N2CCKK WHERE TTH2DS >= 20230101
AND TTH2DS <= 20230131 AND TTBACK IN ('A01')
GROUP BY 'K', 1 , TTBACK CONCAT TTBDCK , TTBPCK

Second SQL
The follow sql work fine. It's the same of the previous without che concat expression in the last group by clause

Select 'K' AS TIPO , 1 AS PERIODO , TTBACK CONCAT TTBDCK AS ELEMENTO1
, TTBPCK AS ELEMENTO2 , count(*) AS QUANTITA ,
IFNULL((Select COUNT(*) FROM SNVEI0F INNER JOIN IBM_DAT/SNCON0F
ON B5CSCK = BNCSCK INNER JOIN IBM_DAT/SNSLL0F ON B5BACK = IMBACK
and IMKDCK = 'DV1' INNER JOIN IBM_DAT/SNSLR0F ON
IMKDCK = N2KDCK and IMCCKK = N2CCKK WHERE B5BACK CONCAT
B5BDCK = TTBACK CONCAT TTBDCK AND B5BPCK = TTBPCK AND
B5CFDT <= 1230131 AND B5CWDT > 1230131 AND B5CFDT <> 0 AND B5BWST
IN ('D') AND B5JDST in (' ' , 'H') AND B5BACK IN ('A01')
) , 0) AS QUANTITAORDINI ,
0 AS QUANTITALIBERA FROM IBM_DAT/SNCID0F INNER JOIN
IBM_DAT/SNCON0F ON TTCSCK = BNCSCK INNER JOIN IBM_DAT/SNSLL0F
ON TTBACK = IMBACK and IMKDCK = 'DV1' INNER JOIN IBM_DAT/SNSLR0F
ON IMKDCK = N2KDCK and IMCCKK = N2CCKK WHERE TTH2DS >= 20230101
AND TTH2DS <= 20230131 AND TTBACK IN ('A01')
GROUP BY 'K', 1 , TTBACK , TTBDCK , TTBPCK

Third SQL
The follow sql work fine. It's the same of the first without SUBQUERY in the select sentence with the CONCAT expression in the group by

Select 'K' AS TIPO , 1 AS PERIODO ,
TTBACK concat TTBDCK as
ELEMENTO1
, TTBPCK AS ELEMENTO2 , count(*) AS QUANTITA ,
0 AS QUANTITALIBERA FROM IBM_DAT/SNCID0F INNER JOIN
IBM_DAT/SNCON0F ON TTCSCK = BNCSCK INNER JOIN IBM_DAT/SNSLL0F
ON TTBACK = IMBACK and IMKDCK = 'DV1' INNER JOIN IBM_DAT/SNSLR0F
ON IMKDCK = N2KDCK and IMCCKK = N2CCKK WHERE TTH2DS >= 20230101
AND TTH2DS <= 20230131 AND TTBACK IN ('A01')
GROUP BY 'K', 1 , TTBACK concat TTBDCK , TTBPCK

Same problem if i use a substr expression

So it's seem that when i place a subquery in a select the group by clause can't contains any complex expression
Honestly i don't find nothing in google related this topic

Thanks

Basilio



***********************************************************************************************************
CONFIDENTIALITY NOTICE

This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information.

If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify us by email to email.security@xxxxxxxxxxxxxxxxx with a copy of this message. You must not, directly or indirectly, use, disclose, distribute, print or copy any part of this message if you are not the intended recipient. NISSAN EUROPE and any of its subsidiaries each reserves the right to monitor all e-mail communications through its networks.

NISSAN EUROPE is neither liable for the proper, complete transmission of the information contained in this communication nor any delay in its receipt. This email was scanned for the presence of computer viruses. In the unfortunate event of infection NISSAN EUROPE does not accept liability.

Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them.

***********************************************************************************************************

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.