Re: Problem counting records
- From: Manfred Sorg <manfred.sorg@xxxxxxxxxxxxxx>
- Date: Fri, 30 Nov 2007 04:13:08 -0800 (PST)
Did you think of this:
select t1.ID, t1.Subject, count(1) as Num_replies_to
from tbl t1
left join tbl t2
on t2.Reply_to=t1.ID
where t1.Reply_to=0
group by t1.ID, t1.Subject
Bye, Manfred
.
- References:
- Problem counting records
- From: Sir Hystrix
- Problem counting records
- Prev by Date: Problem counting records
- Next by Date: Re: Problem counting records
- Previous by thread: Problem counting records
- Next by thread: Re: Problem counting records
- Index(es):