from pta in db.PostTagAssoc
group pta by pta.PostID into t
select new {PostID = t.Key, TagCount=t.Count()}
James Curran
2008-10-25 16:54:50
from pta in db.PostTagAssoc
group pta by pta.PostID into t
select new {PostID = t.Key, TagCount=t.Count()}
This will also show those posts with 0 tags, and is a bit clearer in my opinion.
from p in db.Post select new {PostID = p.ID, TagCount = t.PostTagAssoc.Count}