0
In a training system I have two tables:
TABLE nota_local:
id
id_local
nota
TABLE local:
id
nome
The table nota_local stores the notes that each user gives to the location where the training took place. When I list all the training locations, I give a select in the table local, but wanted to in addition to listing the location, say what the average grade that this site has, ie, give a select also in the table nota_local and already calculating the average, how to do?
SELECT l.nome, SUM(n.nota) / COUNT(n.nota) FROM locais as l INNER JOIN nota_locais as n ON n.id_local = locais.id
works? If yes put an answer explaining– Costamilam