To fix these problems i always put the query into a string first, then echo it out so you can EASILY see what is being queried. I'd recommend doing that, and show us.
I'm assuing mySQL ? 4.x
From looking at it quickly there seems to be something wrong with your JOIN syntax.
$result = mysql_query("
SELECT
a.name AS artist_name
, b.name AS album_name
, s.name as song_name
, s.play_count as play_count
FROM ".$database_table_prefix."song s
JOIN ".$database_table_prefix."artist a
ON s.artist = a.id
JOIN `".$database_table_prefix. " b ON s.album = b." . "album
ORDER BY play_count DESC
LIMIT 500
")
I think that might be closer to what you want, but do what i said, echo out the query and i'll be able to help more, i'm having a headblock trying to read what it is at the mo 😛