SELECT a.*, UNIX_TIMESTAMP(a.createdon) AS timestamp,
				UNIX_TIMESTAMP(a.starton) AS starton, UNIX_TIMESTAMP(a.endon) AS endon,
				COUNT(*) AS piccount, p.adid AS haspics
			FROM xzclf_events a
				INNER JOIN xzclf_cities ct ON a.cityid = ct.cityid
				LEFT OUTER JOIN xzclf_adpics p ON a.adid = p.adid AND p.isevent = '1'
			WHERE (starton <= '2010-03-06' AND endon >= '2010-03-06')
				AND a.enabled = '1' AND a.verified = '1' AND a.expireson >= NOW()
				
			GROUP BY a.adid
			ORDER BY a.createdon DESC
			LIMIT 20Table './ahaindia_ads/xzclf_events' is marked as crashed and should be repaired