I have two tables: users
and courses
. Inside users table i have filed course
where i have course id. Inside courses table i have just ID
and NAME
.
I need to get popular course. I do request:
SELECT u.course, COUNT(*) as freq FROM users u INNER JOIN courses c ON u.course = c.id GROUP BY u.course
As a result: id => freq. But i need to replace ID to NAME of course. How?
Thanks.