select song_id,sum(points_100) as points,avg(avg_100) as rank,sum(played_100) as stations
from rankings_aggregated as rankings use index (ra_created_artist_id_song_id) where created>=20150802 and created<=20150802 and artist_id=9816 group by song_id order by points desc limit 20