I have database with these value
result_id | user_id | degree
1 | 1 | 40 2 | 4 | 30 3 | 2 | 10 4 | 2 | 50 5 | 1 | 60 6 | 1 | 20 7 | 2 | 70 8 | 4 | 10 9 | 4 | 30 10 | 2 | 40
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
http://whathaveyoutriedsofar.com/
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)
I have database with these value
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
http://whathaveyoutriedsofar.com/
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
in addition to this