SELECT
                    evn.Evn_id as "Evn_id",
                    exml.EvnXml_id as "EvnXml_id"
                    FROM dbo.v_Evn evn
                    LEFT JOIN dbo.v_EvnXml exml ON exml.Evn_id = evn.Evn_id
                    LEFT JOIN dbo.v_EvnPL ON (v_EvnPL.EvnPL_id = evn.Evn_rid)
LEFT JOIN dbo.v_EvnPLStom ON (v_EvnPLStom.EvnPLstom_id = evn.Evn_rid)
LEFT JOIN dbo.v_EvnVizitPL ON (v_EvnVizitPL.EvnVizitPL_id = evn.Evn_rid)LEFT JOIN dbo.v_EvnVizitPLStom ON (v_EvnVizitPLStom.EvnVizitPLStom_id = evn.Evn_rid)
                    WHERE (evn.Evn_IsSigned = 2 or EvnXml_IsSigned = 2)AND (evn.lpu_id = '2052475')AND ((v_EvnPL.EvnPL_id IS NOT NULL) OR
                        (v_EvnPLStom.EvnPLstom_id IS NOT NULL) OR
                        (v_EvnVizitPL.EvnVizitPL_id IS NOT NULL) OR
                        (v_EvnVizitPLStom.EvnVizitPLStom_id IS NOT NULL))
