开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜