select a.`id`, CONCAT_WS('/', c.`url`, a.`url`) AS `url`, a.`date`, a.`title`, a.`announcement`, c.`name` from `cms_articles` a left join `cms_categories` c on c.`id`=a.`categoryId` where a.`language`='ru' and a.`published`='1' and a.`date`<='2019-02-21 10:46:40' and (a.`city`='' or a.`city`='TAS') and (a.`categoryId` in (172) or (a.`addCats2` like '%-172-%')) order by a.`ord` desc, a.`id` desc limit 0, 20