views:

27

answers:

1

Here's the query:

select FC.Title, COUNT(FSC.ID) as FCCount, COUNT(FP.NoOfSub), MAX(FP.LastPost)
from ForumCategories FC
left join ForumSubCategories FSC on FSC.CategoryID_FK = FC.ID
left join (select SubCategoryID_FK, Count(ID) NoOfSub, MAX(DatePosted) LastPost  
           from ForumPosts group by SubCategoryID_FK) FP 
on FP.SubCategoryID_FK =  FSC.ID
group by FC.Title
order by FC.Title
A: 

Hey,

You can use LINQPad, which does support ADO.NET ENtity framework: http://www.linqpad.net/

Enter in the QUERY, and there is a SQL tab, which is the SQL translation.

Brian