Subject | Re: [firebird-support] SQL Question Count() statistics |
---|---|
Author | Helen Borrie |
Post date | 2003-10-17T07:01:17Z |
At 05:31 AM 17/10/2003 +0000, you wrote:
count (*) as truecount,
(select count (*) from yourtable t2
where t2.Name = t1.Name
and t2.truefalse = 0) as falsecount
from yourtable t1
where t1.truefalse = 1
group by t1.Name
heLen
>How Can I write a SQL Query for this problem!!select t1.Name,
>Ex table:
>
>Name True/False
>------- --------------
>John T
>Marie T
>Helen T
>Mike F
>John F
>Helen T
>Marie F
>.
>.
>.
>.
>.
>
>And requested result is!
>
>Name True Count False Count
>------- --------------- ----------------
>John 2 4
>Marie 6 9
>Helen 6 0
>.
>.
>.
count (*) as truecount,
(select count (*) from yourtable t2
where t2.Name = t1.Name
and t2.truefalse = 0) as falsecount
from yourtable t1
where t1.truefalse = 1
group by t1.Name
heLen