Reputation: 61
I have written the following code :
select ap.doctorsnum,doc.specialty
from appointments as ap
join doctor as doc
on ap.doctorsnum = doc.doctorsnum
This a screenshot of the first 10 rows of the result. (The actual result contains more than 5k rows)
How can I calculate which is the most frequent value to appear in the "specialty" column?
(All security numbers are fake, they have been randomly generated)
Any help is much appreciated!
Thank you!
Upvotes: 1
Views: 53
Reputation: 1000
I would make a query like:
SELECT
speciality,
COUNT(*) AS value_occurrence
FROM appointments
GROUP BY
speciality
ORDER BY value_occurrence DESC
LIMIT 1;
Upvotes: 2