- This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
I have database with these value
result_id | user_id | degree
I want to know the total degree of each user_id
and then show the highest users having degree for this week , month and year
i have been tried more than 2 hours in these
this is the last thing i do but not do what i want
(“SELECT DISTINCT user_id, degree ORDER BY degree DESC”)
this is what i want
SELECT user_id, SUM(degree) as totalMarks
FROM results
GROUP BY user_id
ORDER BY SUM(degree) DESC
in addition to this
WHERE date > DATE_SUB(NOW(), INTERVAL 1 WEEK)
WHERE date > DATE_SUB(NOW(), INTERVAL 1 MONTH)
WHERE date > DATE_SUB(NOW(), INTERVAL 1 YEAR)