I have two tables - votes and blotes. Votes have a name, time and like/dislike parameter as table columns. Blotes are just some tags people voted for. They have a score (likes minus dislikes) and number_of_votes as fields.
I put together a query to find trending blotes -
SELECT name, number_of_votes, score FROM `vote`
INNER JOIN `blote` ON vote.name=blote.name
WHERE UNIX_TIMESTAMP(now()) - `time` < 60*60*24*7
GROUP BY vote.name
ORDER BY blote.number_of_votes DESC
LIMIT 25
Which is apparently wrong. It finds those Blotes which have more votes and at least one vote in last week. What I want is to find those which have more votes in last week. Hope it makes sense. Thank you.