SELECT t.id,t.title,t.departure,t.periodical ,GROUP_CONCAT((CONCAT_WS(CHAR(22 USING UTF8), at.name, at.cDate,ia.flag,at.resize) )) AS `attachment` FROM `agency_tour` t LEFT JOIN item_attachment ia ON ia.itemId = t.id AND ia.source = 'tour' AND ia.flag IN ('default','special') LEFT JOIN attachment at ON at.id = ia.attachmentId INNER JOIN `agency_ttype` type ON type.id=t.type AND type.visibility=1 INNER JOIN `agency_touritem` ticr ON ticr.tourId=t.id AND ticr.source='country' INNER JOIN `agency_touritem` tici ON tici.tourId=t.id AND tici.source='city' WHERE t.lang='pe' AND t.visibility=1 AND t.`departure` >1422653554 AND t.status='special' GROUP BY t.id ORDER BY t.`priority` DESC LIMIT 0 , 9