try:select 游戏ID,用户ID,上传分数 from table where datediff(now(),上传时间)<=7 and 游戏ID='wow' order by 上传分数 desc limit 0,10
select 游戏ID,用户ID,上传分数 from table where 上传时间 > unix_timestamp(now()) - 7 * 24 * 3600 and 游戏ID='wow' order by 上传分数 desc limit 0,10查询最近7天的wow的积分最高的10个用户。当然如果你要查询确切的一周的 并且 不在 周末的最后时刻查询那么最好 动态生成 sql select 游戏ID,用户ID,上传分数 from table where 上传时间 > unix_timestamp("周一零点") and 上传时间 < unix_timestamp('周末24点')and 游戏ID='wow' order by 上传分数 desc limit 0,10
where datediff(now(),上传时间)<=7 and 游戏ID='wow'
order by 上传分数 desc
limit 0,10
where 上传时间 > unix_timestamp(now()) - 7 * 24 * 3600 and 游戏ID='wow'
order by 上传分数 desc
limit 0,10查询最近7天的wow的积分最高的10个用户。当然如果你要查询确切的一周的 并且 不在 周末的最后时刻查询那么最好 动态生成 sql
select 游戏ID,用户ID,上传分数 from table
where 上传时间 > unix_timestamp("周一零点") and 上传时间 < unix_timestamp('周末24点')and 游戏ID='wow'
order by 上传分数 desc
limit 0,10