Too many connections : select emulators.sysid as sysid, count(emulators.id) as emucnt, systems.sysname as name, systems.keyword as keyword from roms.emulators, roms.systems where emulators.sysid=systems.sysid group by sysid order by sum(ratingcount) DESC LIMIT 10;