在此查询中,我需要删除重复的导师 ID 并计算它们..
SELECT COUNT(t.tutor_id) FROM tutors AS t
INNER JOIN tutor_category_subject as tcs ON t.tutor_id = tcs.tutor_id
INNER JOIN subject AS s ON tcs.subject_id = s.subject_id
WHERE s.subjects LIKE '%business%'
这是查询输出:
+-------------------+
| COUNT(t.tutor_id) |
+-------------------+
| 6 |
+-------------------+
但应该是 4 .. 为什么导师 id 是 3, 6, 15, 15, 16, 16