So, i have a query which looks like this:
x
SELECT sum(distinct 101-players.position) as points from players
INNER JOIN clubs ON players.id_club=clubs.id_club
GROUP BY clubs.club
ORDER BY points desc LIMIT 10 OFFSET 10;
And it gives me back:
222
148
136
94
78
53
11
33
34
51
Is there any way that this query will give me back added value? Just number 860.
Kindly please help me :/
Advertisement
Answer
You can just sum all the points you got from your query:
select sum(points) from (
SELECT sum(distinct 101-players.position) as points from players
INNER JOIN clubs ON players.id_club=clubs.id_club
GROUP BY clubs.club
ORDER BY points desc LIMIT 10 OFFSET 10) t