1
This code solves:
SELECT TIME, SUM(J.PONTOS) AS PONTOS FROM (
SELECT TIME1 AS TIME, PONTOSTIME1 AS PONTOS
FROM JOGOS
UNION ALL
SELECT TIME2 AS TIME, PONTOSTIME2 AS PONTOS
FROM JOGOS) AS J
GROUP BY TIME
ORDER BY PONTOS DESC
Results in:
TIME PONTOS
uruguai 9
russia 6
arabia 3
egito 0
See working in http://sqlfiddle.com/#! 9/292934/25
thank you very much worked perfectly
– Farlen Geraldo
Thank you. To help the site, please check the 'accepted' option (check icon below the reply score)
– Rogério Dec