SELECT a.id, a.f36320 AS contragent_id, (SELECT f435 FROM cb_data42 WHERE id=a.f36320 limit 1) AS contragent_name, (SELECT f18540 FROM cb_data381 WHERE status=0 AND f43240 Like '%Юридический%' AND f8131=a.f36320 limit 1) AS adress, (SELECT f18400 FROM cb_data381 WHERE status=0 AND f43240 Like '%Юридический%' AND f8131=a.f36320 limit 1) AS lat, (SELECT f18410 FROM cb_data381 WHERE status=0 AND f43240 Like '%Юридический%' AND f8131=a.f36320 limit 1) AS lon, a.f34910 AS domen, a.f34920 AS vitrina FROM cb_data2120 AS a WHERE a.status=0