use an AR query to get a grouped count instead of custom SQL

refs CNVS-7032

primarily, Mysql's execute doesn't return rows, but this is much
much cleaner anyway

Change-Id: Ia8c13374e5625ae0568f9bc386101dd2a2048d88
Reviewed-on: https://gerrit.instructure.com/28620
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>