I am trying to query tables using join but I can’t get success here my tables
Score
id , user_id , score , week
1 , 123 , 2 , 1
2 , 432 , 2 , 1
3 , 432 , 3 , 1
4 , 123 , 2 , 2
I want to query top twenty users records on the bases of sum of week 1 and week 2’s max total
I want the result should be
id , user_id , week1score , week2score
1 , 123 , 2 , 2
2 , 432 , 3 , 0
The formula is order by descending sum(max(week1)+max(week2))
Thanks
Inam
something like this would do
You need a composit index on the following columns