没有经过测试,但这应该可以解决问题:
var q = from c in ctx.Category join clg in ( from cl in ctx.CategoryListing group cl by cl.CategoryID into g select new { CategoryID = g.Key, Frequency = g.Count()} ) on c.CategoryID equals clg.CategoryID into cclg from v in cclg.DefaultIfEmpty() where c.GuideID==1 select new { c.CategoryID, Frequency = v.Frequency ?? 0 };