开发者

How to get the trending tags using php and mysql?

开发者 https://www.devze.com 2022-12-23 09:37 出处:网络
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

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

精彩评论

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