SELECT (SELECT count(id) FROM comments WHERE bankregnum=r.bnkregnum AND approve=1) count_comm , (SELECT cntbr FROM banks_in_city_rus WHERE regnum = r.bnkregnum AND city = "Солнцево" ) count_offices , r.* FROM (SELECT c.*, b.logo banklogo, bankname, b.regnum regnum_common FROM crapp_rus c LEFT JOIN banks_rus b ON c.bnkregnum=b.regnum WHERE c.activ=1 AND EXISTS (SELECT 1 FROM cityadv_rus WHERE AND (cityname="*" or cityname="Солнцево")) ORDER BY LOWER(advname) LIKE '%налич%' DESC, priority ) r