SELECT *
FROM images
WHERE userid = $userid
AND uploadeddate >= CURDATE() - INTERVAL WEEKDAY(day) DAY
AND uploadeddate < CURDATE() - INTERVAL WEEKDAY(day) DAY + INTERVAL 7 DAY
(userid, uploadeddate)
. पर एक इंडेक्स बनाएं इसके लिए तेजी से काम करें।