Subject | Re: Best table structure for Debit/Credit |
---|---|
Author | Scott Moon |
Post date | 2006-06-26T18:50:38Z |
--- In firebird-support@yahoogroups.com, Matthias Hanft <mh@...> wrote:
SELECTed fields out of your GROUP BY clause. For example:
SELECT fieldA, SUM(fieldB), fieldC
FROM sometable
GROUP BY fieldA /* omitting fieldC */
...will produce that error. Adding fieldC to the GROUP BY clause would
fix it.
Scott
> Whenever I insert the following section for the "current_aggregate function or the GROUP BY clause)
> reminders" result column:
>
> > SUM(
> > case
> > when b.transtype = 'R'
> > and NOT EXISTS(select * from billing b2
> > where b2.custno = b.custno
> > and b2.transtype = 'P'
> > and b2.transdate >= b.transdate)
> > then 1 else 0 end) as current_reminders
>
> I get this error message:
>
> Dynamic SQL Error
> -SQL error code = -104
> -Invalid expression in the select list (not contained in either an
>That error generally means that you've left one or more non-aggregated
> If I remove that section, the query runs fine again.
SELECTed fields out of your GROUP BY clause. For example:
SELECT fieldA, SUM(fieldB), fieldC
FROM sometable
GROUP BY fieldA /* omitting fieldC */
...will produce that error. Adding fieldC to the GROUP BY clause would
fix it.
Scott