Select Count of Distinct Value


/ Published in: SQL
Save to your folder(s)



Copy this code and paste it in your HTML
  1. SELECT ChurchID, ChurchName, COUNT( * ) AS COUNT
  2. FROM (
  3.  
  4. SELECT churchxref.ChurchID, church.ChurchName
  5. FROM tripapplication
  6. LEFT JOIN tripleg ON tripapplication.triplegid = tripleg.triplegid
  7. LEFT JOIN person ON person.PersonID = tripapplication.personid
  8. LEFT JOIN churchxref ON churchxref.system_user_id = person.PersonID
  9. LEFT JOIN church ON church.ChurchID = churchxref.ChurchID
  10. WHERE tripleg.tripid = 232
  11. ) AS DerivedTableB
  12. GROUP BY ChurchID

URL: http://answers.google.com/answers/threadview/id/235114.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.