本文介绍了PHP 和 MySQL 排名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
`id` int(11) NOT NULL,
`ip` text NOT NULL,
`song` text NOT NULL,
`vote` int(11) NOT NULL
我创建了一个投票系统,我想打印获得更多投票的歌曲......我该怎么做?谢谢
I have created a voting system and I would like to print the songs with more votes ... how do I do it? Thank you
推荐答案
我认为你需要尝试计算这首歌的总票数
I think you need to try for counting total votes for the song
SELECT SUM(vote)as VOTECOUNT, song FROM votes GROUP BY song ORDER BY SUM(vote) DESC LIMIT 10
这篇关于PHP 和 MySQL 排名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!