Array ( [0] => 00000 [1] => [2] => )
SELECT parentId, headerOrder, action, filename, alt, pdate, parentName, parentCatName, id, title, textCleared, url, categoryUrl FROM ( (SELECT 60 as parentId, '1новини' as headerOrder, 'new' as action, news.id, (select ni.filename from news_images ni where ni.contId = news.id order by ismain desc, position asc limit 1) as filename, (select ni.alt from news_images ni where ni.contId = news.id order by ismain desc, position asc limit 1) as alt, i18n.title as title, i18n.textCleared, cat.title as parentName, cc.title as parentCatName, news.url, news.pdate, c.url as categoryUrl FROM news LEFT JOIN news_i18n i18n on i18n.newsId = news.id LEFT JOIN categories as c on c.id = news.categoryId LEFT JOIN categories_i18n as cc on cc.categoryId = c.parentId LEFT JOIN categories_i18n as cat on cat.categoryId = news.categoryId WHERE (news.categoryId = 60) AND news.isactive = 1 AND (pdate >= '2018-03-21 00:00:00' AND pdate <= '2019-03-21 23:59:59') ORDER BY headerOrder asc, id desc LIMIT 4) UNION (SELECT 51 as parentId, '2крими' as headerOrder, 'new' as action, news.id, (select ni.filename from news_images ni where ni.contId = news.id order by ismain desc, position asc limit 1) as filename, (select ni.alt from news_images ni where ni.contId = news.id order by ismain desc, position asc limit 1) as alt, i18n.title as title, i18n.textCleared, cat.title as parentName, cc.title as parentCatName, news.url, news.pdate, c.url as categoryUrl FROM news LEFT JOIN news_i18n i18n on i18n.newsId = news.id LEFT JOIN categories as c on c.id = news.categoryId LEFT JOIN categories_i18n as cc on cc.categoryId = c.parentId LEFT JOIN categories_i18n as cat on cat.categoryId = news.categoryId WHERE (news.categoryId = 51) AND news.isactive = 1 AND (pdate >= '2018-03-21 00:00:00' AND pdate <= '2019-03-21 23:59:59') ORDER BY headerOrder asc, id desc LIMIT 4) UNION (SELECT 4 as parentId, '3жълто' as headerOrder, 'new' as action, news.id, (select ni.filename from news_images ni where ni.contId = news.id order by ismain desc, position asc limit 1) as filename, (select ni.alt from news_images ni where ni.contId = news.id order by ismain desc, position asc limit 1) as alt, i18n.title as title, i18n.textCleared, cat.title as parentName, cc.title as parentCatName, news.url, news.pdate, c.url as categoryUrl FROM news LEFT JOIN news_i18n i18n on i18n.newsId = news.id LEFT JOIN categories as c on c.id = news.categoryId LEFT JOIN categories_i18n as cc on cc.categoryId = c.parentId LEFT JOIN categories_i18n as cat on cat.categoryId = news.categoryId WHERE (news.categoryId = 4) AND news.isactive = 1 AND (pdate >= '2018-03-21 00:00:00' AND pdate <= '2019-03-21 23:59:59') ORDER BY headerOrder asc, id desc LIMIT 4) UNION (SELECT 3 as parentId, '4скандали' as headerOrder, 'new' as action, news.id, (select ni.filename from news_images ni where ni.contId = news.id order by ismain desc, position asc limit 1) as filename, (select ni.alt from news_images ni where ni.contId = news.id order by ismain desc, position asc limit 1) as alt, i18n.title as title, i18n.textCleared, cat.title as parentName, cc.title as parentCatName, news.url, news.pdate, c.url as categoryUrl FROM news LEFT JOIN news_i18n i18n on i18n.newsId = news.id LEFT JOIN categories as c on c.id = news.categoryId LEFT JOIN categories_i18n as cc on cc.categoryId = c.parentId LEFT JOIN categories_i18n as cat on cat.categoryId = news.categoryId WHERE (news.categoryId = 3) AND news.isactive = 1 AND (pdate >= '2018-03-21 00:00:00' AND pdate <= '2019-03-21 23:59:59') ORDER BY headerOrder asc, id desc LIMIT 4) UNION (SELECT 55 as parentId, '5Здраве' as headerOrder, 'new' as action, news.id, (select ni.filename from news_images ni where ni.contId = news.id order by ismain desc, position asc limit 1) as filename, (select ni.alt from news_images ni where ni.contId = news.id order by ismain desc, position asc limit 1) as alt, i18n.title as title, i18n.textCleared, cat.title as parentName, cc.title as parentCatName, news.url, news.pdate, c.url as categoryUrl FROM news LEFT JOIN news_i18n i18n on i18n.newsId = news.id LEFT JOIN categories as c on c.id = news.categoryId LEFT JOIN categories_i18n as cc on cc.categoryId = c.parentId LEFT JOIN categories_i18n as cat on cat.categoryId = news.categoryId WHERE (news.categoryId = 55) AND news.isactive = 1 AND (pdate >= '2018-03-21 00:00:00' AND pdate <= '2019-03-21 23:59:59') ORDER BY headerOrder asc, id desc LIMIT 4) UNION (SELECT 80 as parentId, '6Сензационно' as headerOrder, 'new' as action, news.id, (select ni.filename from news_images ni where ni.contId = news.id order by ismain desc, position asc limit 1) as filename, (select ni.alt from news_images ni where ni.contId = news.id order by ismain desc, position asc limit 1) as alt, i18n.title as title, i18n.textCleared, cat.title as parentName, cc.title as parentCatName, news.url, news.pdate, c.url as categoryUrl FROM news LEFT JOIN news_i18n i18n on i18n.newsId = news.id LEFT JOIN categories as c on c.id = news.categoryId LEFT JOIN categories_i18n as cc on cc.categoryId = c.parentId LEFT JOIN categories_i18n as cat on cat.categoryId = news.categoryId WHERE (news.categoryId = 80) AND news.isactive = 1 AND (pdate >= '2018-03-21 00:00:00' AND pdate <= '2019-03-21 23:59:59') ORDER BY headerOrder asc, id desc LIMIT 4) UNION (SELECT 50 as parentId, '7свят' as headerOrder, 'new' as action, news.id, (select ni.filename from news_images ni where ni.contId = news.id order by ismain desc, position asc limit 1) as filename, (select ni.alt from news_images ni where ni.contId = news.id order by ismain desc, position asc limit 1) as alt, i18n.title as title, i18n.textCleared, cat.title as parentName, cc.title as parentCatName, news.url, news.pdate, c.url as categoryUrl FROM news LEFT JOIN news_i18n i18n on i18n.newsId = news.id LEFT JOIN categories as c on c.id = news.categoryId LEFT JOIN categories_i18n as cc on cc.categoryId = c.parentId LEFT JOIN categories_i18n as cat on cat.categoryId = news.categoryId WHERE (news.categoryId = 50) AND news.isactive = 1 AND (pdate >= '2018-03-21 00:00:00' AND pdate <= '2019-03-21 23:59:59') ORDER BY headerOrder asc, id desc LIMIT 4) ) as id GROUP by id ORDER BY headerOrder ASC, action ASC, id DESC