I need to get the sum of 10 lines, for this I try to use the following query:
SELECT SUM(hosts) FROM traffic LIMIT 10 I get for some reason the mousse of all the records ...
How can I get the amount of only 10 entries?
SELECT SUM (hosts) FROM traffic WHERE condition for the selection of 10 lines
SELECT SUM (hosts) FROM (SELECT hosts FROM traffic ORDER BY поле, по которому сортировка LIMIT 10) t
Try:
SELECT SUM(hosts) FROM (SELECT * FROM traffic LIMIT 10) AS tables Source: https://ru.stackoverflow.com/questions/840373/
All Articles