SELECT n.*, (SELECT MIN(params) FROM %s AS nga INNER JOIN %s AS ng ON ng.id = nga.group_id WHERE nga.news = n.id) AS newsparams FROM %s AS n JOIN %s AS nl ON n.id=nl.news AND nl.locale=:locale JOIN %s AS nga_0 ON n.id=nga_0.news AND nga_0.group_id=:group WHERE n.status="active" AND n.site=:site AND nl.locale=:locale AND (nga_0.group_id=:group) AND ((n.startdate IS NULL OR n.startdate <= CURDATE()) AND (n.starttime IS NULL OR n.starttime <= CURTIME())) AND (n.enddate IS NULL OR n.enddate >= CURDATE()) AND nl.active="1" ORDER BY nl.importance DESC, n.date DESC, nl.time DESC