SELECT `a`.`id_content_place`, `a`.`distance`, `g`.*, `gi`.`filename`, `gi`.`title` AS `gallery_item_title`, `t`.`title`, `t`.`lead`, `t`.`url` FROM `content_place` AS `a` LEFT JOIN `content_gallery` AS `g` ON a.id_content_place = g.source_id and g.source_table="content_place" LEFT JOIN `content_gallery_item` AS `gi` ON gi.id_content_gallery = g.id_content_gallery and gi.cover=1 LEFT JOIN `translation` AS `t` ON a.id_content_place = t.id_source and t.table_source="content_place" WHERE (a.status = 1) AND (a.id_content_place_category = 0) AND (t.lang = 'pl_PL') ORDER BY `a`.`position` ASCstring(5) "pl_PL"