SELECT SQL_CALC_FOUND_ROWS * FROM(SELECT 1 stype,, n.string_id, n.short_text, '' link, n.subdomain, n.date_up, n.title, n.title_long, n.img_url, n.views, m.visitors, n.has_video, r.first_name, r.last_name, as rid FROM news n INNER JOIN persons r ON LEFT OUTER JOIN yametrika_news m ON m.news_id = n.idWHERE n.status='publish' UNION SELECT 2 stype,, n.string_id, n.short_text,, n.subdomain, n.date_up, n.title, '' title_long, n.img_url, n.views, m.visitors, n.has_video, '' first_name, '' last_name, '' as rid FROM qnews n LEFT OUTER JOIN yametrika_qnews m ON m.qnews_id = n.idWHERE n.img_url != '' AND n.publish = '1' AND n.content != '' ) n ORDER BY n.date_up DESC LIMIT 3800,40