I need 5 columns with highest values (values must be sum of each column) for report. I have about 40 contury colunms something like england_turist, polad_turists, us_turists, india_turists... eng - 152(sum), pol - 280(sum), us - 54(sum), in - 36(sum)... and query needs to pick pol - 280 and eng - 152. So query need to sum every column and pick 5 columns with highest values.
I got result from here but how to create query
SELECT * FROM
(
SELECT 'Bmw' AS vrstaautomobila, SUM(bmw) AS brautomobila FROM unos_korisnika
UNION
SELECT 'Mercedes' AS vrstaautomobila, SUM(mercedes) AS brautomobila FROM unos_korisnika
UNION
SELECT 'Opel' AS vrstaautomobila, SUM(opel) AS brautomobila FROM unos_korisnika
UNION
SELECT 'Nissan' AS vrstaautomobila, SUM(nissan) AS brautomobila FROM unos_korisnika
UNION
SELECT 'Peguoet' AS vrstaautomobila, SUM(peguoet) AS brautomobila FROM unos_korisnika
UNION
SELECT 'Volkswagen' AS vrstaautomobila, SUM(volkswagen) AS brautomobila FROM unos_korisnika
)
AS results
ORDER BY brautomobila DESC
LIMIT 5