Subject Odp: [firebird-support] Problem when group by a sub-query
Author liviuslivius@poczta.onet.pl
Hi,

The error is correct -ypu use a.clave_fact what is not in group by

Regards,
Karol Bieniaszewski

----- Reply message -----
Od: "Claudio Romero" <clauslack@...>
Do: <firebird-support@yahoogroups.com>
Temat: [firebird-support] Problem when group by a sub-query
Data: pt., lip 19, 2013 16:26


select (select cobrador from BUSCA_COBRADOR_POR_aplicante
(a.clave_fact))as cobrador,sum(a.ftot)
from VISTA_COMPROBANTES a
group by 1

Show this error.

Invalid expression in the select list (not contained in either an aggregate
function or the GROUP BY clause)

I use Firebird 2.1.6.



2013/7/19 Marcin Bury <marcin.bury@...>

> **
>
>
> Claudio
>
> W dniu 19.07.2013 16:18, Claudio Romero pisze:
>
> > Problem when group by a sub-query
> > I have
> > select (select cobrador from BUSCA_COBRADOR_POR_aplicante
> (a.clave_fact)),a.ftot
> > from VISTA_COMPROBANTES a
> >
> > (BUSCA_COBRADOR_POR_aplicante is a Stored Procedure)
> >
> > Result
> > Cobrador Ftot
> > ------- ----
> > 1 369.00
> > 3 122.00
> > 1 72.00
> > 11 310.00
> > 1 85.00
> > 3 560.00
> >
> > I must sum(ftot) group by cobrador, like this
> >
> > Cobrador Sum
> > -------- ---
> > 1 526.00
> > 3 682.00
> > 11 310.00
> >
> > But in Firebird 2.1.6.18518, this sql show an error
> > select (select cobrador from BUSCA_COBRADOR_POR_aplicante
> > (a.clave_fact))as cobrador,sum(a.ftot)
> > from VISTA_COMPROBANTES a
> > group by cobrador
> >
> > Invalid expression in the select list (not contained in either an
> > aggregate function or the GROUP BY clause)
> >
> > Any workarround ?
> > Regards
> >
> Try
>
>
> select (select cobrador from BUSCA_COBRADOR_POR_aplicante
> (a.clave_fact))as cobrador,sum(a.ftot)
> from VISTA_COMPROBANTES a
> group by 1
>
>
>


[Non-text portions of this message have been removed]



------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Yahoo! Groups Links





[Non-text portions of this message have been removed]