Subject Re: COUNT(field > val)
Author Adam
--- In firebird-support@yahoogroups.com, "skysword76"
<skysword76@y...> wrote:
>
> Hello,
>
> Is it possible to have a query like
>
> SELECT tNo, COUNT(tField > 0) AS POSITIVE FROM table
> GROUP BY tNo
>
> I'm interested in returning the number of values greater than ... ,
> without using another query as view from the same table.
>
> It seems faster for me to count the value based on a condition within
> the same SELECT query, rather than having another query.
>
> But maybe I don't know the Firebird 1.5.3 syntax... and this COUNT
> actually exists. Otherwise it would be nice to be a feature.
>

The normal syntax is this:

SELECT tNo, COUNT(*) AS POSITIVE
FROM table
WHERE tField > 0
GROUP BY tNo

Adam