Article View: borland.public.interbase.sql
Article #412Error with Subquery and Group By
From: Adalberto Baldini
Date: Wed, 05 Mar 2008 16:22
Date: Wed, 05 Mar 2008 16:22
28 lines
1924 bytes
1924 bytes
With following query after added last column subquery, I get error :
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
invalid column reference.
select a.o_csoc, a.o_nreserc, a.o_conto, a.o_sezio, a.o_curcytot,
a.o_curcynaz, max(a.o_percam),
sum(a.o_prnzdr) - sum(a.o_prnzav) Sdo_Naz,
sum(a.o_prexdr), sum(a.o_prexav),
sum(a.o_prnzdr), sum(a.o_prnzav),
(select b1.nicknm from sezio b1 where b1.csoc = a.o_csoc and
b1.nreserc = a.o_nreserc and b1.csez = a.o_sezio and
b1.fdel = '0' ) as DescrSezio
from SDICOGE (:csoc ,: abinp , :fil , :lastdata , :allambfil ) a
group by a.o_csoc, a.o_nreserc, a.o_conto, a.o_sezio,
a.o_curcytot, a.o_curcynaz
order by a.o_csoc, a.o_nreserc, a.o_conto, a.o_sezio, a.o_curcytot
If I remove sum fields and group by clause query works.
If I remove subquery , query works.
Which is the conflict ?
Thanks
Adalberto Baldini
Technical Details
Message-ID:
<47cec8df$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,5277ddb39d374d09 X-Google-Attributes: gid114a0e,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Date: Wed, 05 Mar 2008 17:22:56 +0100 From: Adalberto Baldini <finman@swissonline.ch> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.interbase.sql Subject: Error with Subquery and Group By Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 080305-0, 05/03/2008), Outbound message X-Antivirus-Status: Clean NNTP-Posting-Host: 83.77.150.84 Message-ID: <47cec8df$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1204734175 83.77.150.84 (5 Mar 2008 08:22:55 -0700) Lines: 28 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail