Your problem is that the left join finds the track id for each album id. Solutions:
right join
a subquery of the amounts, assuming the sequel supports: left join (select album_id, count(album_id) as count from tracks group by album_id) t on
spill up from albums a, tracks t where t.album_id=a.idinstead of joining.
source
share