Out of resources when opening file '/tmp/#sql_c10_2.MYI' (Errcode: 24)SELECT ct.cityid, c.countryid, COUNT(*) as adcnt
FROM phpas_ads a
INNER JOIN phpas_cities ct ON ct.cityid = a.cityid AND (a.enabled = '1' AND a.verified = '1' AND a.expireson >= NOW())
INNER JOIN phpas_countries c ON ct.countryid = c.countryid
WHERE ct.enabled = '1' AND c.enabled = '1'
GROUP BY ct.cityid