thanks for your answer but i think it's more difficult than i thought.
i've looking the tables and the relations and fields are like this.
I don't know if it's clear enough, but i want to make two ratings lists one with songs and another with albums
I attach an excel file
Thank you again for your pacience
artists Albums songs ratings
Id artist_name Id name artist_id Id album_id name Id Album_id points type
1 kraftwerk 1 Computer world 1 450 1 pocket calculator 1 450 5 song
2 U2 2 man machine 1 450 1 pocket calculator 2 450 8 song
3 Madonna 3 like a virgin 3 120 3 noname 3 3 9 album
relations
artists albums albums songs songs ratings type=song
id artist_id Id album_id id album_id
albums ratings type=album
id album_id
result for song rating
artist album song average
kraftwerk computer world pocket calculator 6,5
result for albums rating
artist album average
madonna like a virgin 9