Subject | Re: COUNT(field > val) |
---|---|
Author | Adam |
Post date | 2005-12-28T07:18:46Z |
--- In firebird-support@yahoogroups.com, "skysword76"
<skysword76@y...> wrote:
SELECT tNo, COUNT(*) AS POSITIVE
FROM table
WHERE tField > 0
GROUP BY tNo
Adam
<skysword76@y...> wrote:
>The normal syntax is this:
> 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.
>
SELECT tNo, COUNT(*) AS POSITIVE
FROM table
WHERE tField > 0
GROUP BY tNo
Adam