Select 5 thousand rows from a table

Asked

Viewed 47 times

0

I have a table with more than 5 thousand lines, where I have a column with year, nomes_municipios and another with values. I can get an average with a municipality that is represented on a line, but I wanted to do with all at once. These are all Brazilian municipalities. Is there any way? This is the code I’m using, but with this code, I can only do it one at a time.

SELECT nome, AVG(cota_fpm)
FROM economia
where nome = 'Alta Floresta D''Oeste';

1 answer

2


Simply group the result by the names of the municipalities using the group by.

Try with this query:

SELECT nome, AVG(cota_fpm)
FROM economia
GROUP BY nome;
  • I’ll try and get the result right.

  • Buddy, thank you so much. It all worked out right here.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.