Quick join/subquery help

Hi guys,

I’m trying to pull a count of termIDs from one table and the term_name from another table.

Here’s the query that’s working to get the count:

SELECT value AS tid, COUNT(value) AS count FROM notifications_fields WHERE field = ‘tid’ GROUP BY value ORDER BY count DESC;

Now I need to pull the term_name from the term_data table. Both tables (notifications_fields and term_data) have tid columns.

Thanks!
Kevin


select value AS tid, 
       term_name,
       count(value) as count 
  from notifications_fields
  join term_data
    on notifications_fields.tid = term_data.tid
 where field = 'tid' 
 group by value,
       term_name
 order by count desc

Thank you swampBoogie!