I'm using PostgreSQL 9.3, and I've got this big, ugly query...
SELECT cai.id
FROM common_activityinstance cai
JOIN common_activityinstance_settings cais ON cai.id = cais.activityinstance_id
JOIN common_activitysetting cas ON cas.id = cais.id
WHERE cai.end_time::date = '2015-09-11'
AND ( key = 'disable_student_nav' AND value = 'True'
OR key = 'pacing' AND value = 'student');
...which gives me this result...
id
------
1352
1352
1353
1353
1354
1355
(6 rows)
How can I improve my query to get the count of the duplicate rows (2 in this example)?