Subject | Re: [firebird-support] Aggregate selects |
---|---|
Author | Daniel Berstein |
Post date | 2003-07-30T13:38:48Z |
That should be,
SELECT A, SUM(B)
FROM XYZ
GROUP BY A
HAVING SUM(B) BETWEEB 10 AND 20.
If you mix regular column values AND agregate functions you MUST use a "group by"
statemente, otherwise doesn't make any sense. Tha "having" clause can be applied to
the result of the agregated functions, just like a "where" clause is used to filter regular
column values.
Regards,
Daniel Berstein.
SELECT A, SUM(B)
FROM XYZ
GROUP BY A
HAVING SUM(B) BETWEEB 10 AND 20.
If you mix regular column values AND agregate functions you MUST use a "group by"
statemente, otherwise doesn't make any sense. Tha "having" clause can be applied to
the result of the agregated functions, just like a "where" clause is used to filter regular
column values.
Regards,
Daniel Berstein.
On 30 Jul 2003 at 11:29, Tim Ledgerwood wrote:
> Hi all,
>
> Is it possible to do something like the following :
>
> SELECT A, SUM(B) FROM XYZ WHERE SUM(B) BETWEEN 10 AND 20 ?
>
> Thanks
>
> Tim
>
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
> To unsubscribe from this group, send an email to:
> firebird-support-unsubscribe@yahoogroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>