How to get the trending tags using php and mysql?
I have a table : tags(tagname,entryid,stamp) and i want to make a section for the most trending tags today, the tagna开发者_运维技巧me column has no unique value, because many entries has the same tag, so the php code that i want should display the most attached tags today.
Note: the "stamp" column is the date of adding the tag in UNIX time stamp format.
Thanks
SELECT `tagname`, COUNT(*) AS `cnt`
FROM `tags`
WHERE `stamp` >= UNIX_TIMESTAMP(DATE(NOW()))
GROUP BY `tagname`
ORDER BY `cnt` DESC
LIMIT 10
精彩评论