MySQL server has gone awaySELECT ct.cityid, c.countryid, COUNT(*) as adcnt FROM vivaru_ads a INNER JOIN vivaru_cities ct ON ct.cityid = a.cityid AND (a.enabled = '1' AND a.verified = '1' AND a.expireson >= NOW() AND a.paid <> '0') INNER JOIN vivaru_countries c ON ct.countryid = c.countryid WHERE ct.enabled = '1' AND c.enabled = '1' GROUP BY ct.cityid