/ Published in: SQL
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
SELECT ChurchID, ChurchName, COUNT( * ) AS COUNT FROM ( SELECT churchxref.ChurchID, church.ChurchName FROM tripapplication LEFT JOIN tripleg ON tripapplication.triplegid = tripleg.triplegid LEFT JOIN person ON person.PersonID = tripapplication.personid LEFT JOIN churchxref ON churchxref.system_user_id = person.PersonID LEFT JOIN church ON church.ChurchID = churchxref.ChurchID WHERE tripleg.tripid = 232 ) AS DerivedTableB GROUP BY ChurchID
URL: http://answers.google.com/answers/threadview/id/235114.html