Got error 28 from storage engine
SELECT DISTINCT sites.*, settlements.TITLE AS settlement, settlements.map_x, settlements.map_y, IF(sites.clicks_left > 0 OR Deals.per_click = 0,Deals.Deal_ID,0) as `main_deal` FROM sites INNER JOIN SitesPages USING(siteID) LEFT JOIN settlements ON (sites.settlementID=settlements.settlementID) LEFT JOIN Deals ON (Deals.siteID = sites.siteID AND Deals.Deal_type_ID = 1 AND (CURDATE() BETWEEN Deals.Beginning_date AND Deals.Temp_date) AND Deals.Active = 1) WHERE MainPageID = 7172