Subject Re: [firebird-support] SQL Question Count() statistics
Author Dimitry Sibiryakov
On 17 Oct 2003 at 5:31, tanz_anthrox wrote:

>Name True Count False Count
>------- --------------- ----------------
>John 2 4
>Marie 6 9
>Helen 6 0
>
>How Can I do this?

By many ways. SP is one of them. CASE is the second. A "plain SQL"
solution:

SELECT Name,
(SELECT count(*) FROM table t2
WHERE t1.Name=t2.Name and t2."True/False"="T")
as "True count",
(SELECT count(*) FROM table t2
WHERE t1.Name=t2.Name and t2."True/False"="F")
as "False count"
FROM table t1
GROUP by Name

SY, Dimitry Sibiryakov.