I want to implement a tag list, for instance, top ten tags used in the website. Are there any tutorials or articles that can help me to create this!

For example:

#topic  (200 mentions)
#topic (150 mentions)
#topic (50 mentions) ....

and so on..

Accepted Answer

i assume you have a table tags, posts and posts_tags (you haven't told us what you want to tag …) to associate them

you then want to count the number of times a tag was used:

    select count(*)
      from `posts_tags` pt
inner join `tags` t
        on pt.tagid = t.tagid
  group by t.tagid
  order by count(*) desc
     limit 10
Written by knittl
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki