Subject | Re: [firebird-support] COUNT(field > val) |
---|---|
Author | Arno Brinkman |
Post date | 2005-12-29T10:18:16Z |
Hi,
SUM(CASE WHEN tField > 0 THEN 1 ELSE 0 END) AS POSITIVE,
SUM(CASE WHEN tField < 0 THEN 1 ELSE 0 END) AS NEGATIVE,
SUM(CASE WHEN tField = 0 THEN 1 ELSE 0 END) AS ZEROES (...etc)
FROM
table
GROUP BY
tNo
Regards,
Arno Brinkman
ABVisie
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
General database developer support:
http://www.databasedevelopmentforum.com
Firebird open source database (based on IB-OE) with many SQL-99 features:
http://www.firebirdsql.org
http://www.firebirdsql.info
Support list for Interbase and Firebird users:
firebird-support@yahoogroups.com
Nederlandse firebird nieuwsgroep:
news://newsgroups.firebirdsql.info
> SELECT tNo, COUNT(tField > 0) AS POSITIVE,COUNT(tField < 0) AS NEGATIVE,SELECT tNo,
> COUNT(tField = 0) AS ZEROES (...etc)
> FROM table
> GROUP BY tNo
SUM(CASE WHEN tField > 0 THEN 1 ELSE 0 END) AS POSITIVE,
SUM(CASE WHEN tField < 0 THEN 1 ELSE 0 END) AS NEGATIVE,
SUM(CASE WHEN tField = 0 THEN 1 ELSE 0 END) AS ZEROES (...etc)
FROM
table
GROUP BY
tNo
Regards,
Arno Brinkman
ABVisie
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
General database developer support:
http://www.databasedevelopmentforum.com
Firebird open source database (based on IB-OE) with many SQL-99 features:
http://www.firebirdsql.org
http://www.firebirdsql.info
Support list for Interbase and Firebird users:
firebird-support@yahoogroups.com
Nederlandse firebird nieuwsgroep:
news://newsgroups.firebirdsql.info