开发者

mysql between query in dates

开发者 https://www.devze.com 2023-02-15 09:42 出处:网络
$currentdate = date(\"Y-m-d\"); $lastweekdate = date(\"Y-m-d\", strtotime(\"-6 days\")); $querytopscoreofweek=
$currentdate = date("Y-m-d");
$lastweekdate = date("Y-m-d", strtotime("-6 days")); 
$querytopscoreofweek  = 
"SELECT * FROM fb_user WHERE  last_date".
" BETWEEN $lastweekdate AND $currentdate ORDER BY oldscore DESC LIMIT 0,10";

i have field name last_date in this format $currentdate = date("Y-m-d"); i want to execute the above query i want it to return all the users of last week and mean between $lastweekdate and $currentdate and which has also old_score greater in descending order and only 10 users,BUT THE PROBLEM IS THAT IT IS NOT 开发者_运维技巧RETURNING ANY THING ANY HINT PLZ


SELECT * 
FROM fb_user 
WHERE last_date BETWEEN curdate() AND curdate() - interval 6 day 
ORDER BY oldscore DESC LIMIT 10
0

精彩评论

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

关注公众号