这个节目最后 10 个新结果,一切正常
$query = "SELECT s.name AS song,
SUM(v.hit_shit) AS hit,
COUNT(v.hit_shit) - SUM(v.hit_shit) AS shit,
MAX(date_voted) AS last_vote
FROM songs AS s
INNER JOIN votes AS v ON v.song_id = s.id
WHERE v.date_voted >= CURDATE()
GROUP BY s.id
ORDER BY last_vote DESC
LIMIT 10";
$song = mysql_query($query);
但这说明了一切,但我只需要 5 个 :(
$query = "SELECT s.name AS song,
SUM(v.hit_shit) AS hit,
COUNT(v.hit_shit) - SUM(v.hit_shit) AS shit
FROM songs AS s
INNER JOIN votes AS v ON v.song_id = s.id
WHERE v.date_voted >= CURDATE()
AND v.date_voted < CURDATE() + INTERVAL 1 DAY
GROUP BY s.id
ORDER BY hit DESC, shit ASC, song ASC";
$song = mysql_query($query);
ps对不起4我的英语不好