
                with cte as (
                    select distinct
                        EvnAll.Evn_id
                    from
                        dbo.v_Evn Evn
                        inner join v_Evn EvnAll on EvnAll.Evn_rid = Evn.Evn_rid
                    where
                        Evn.Evn_id = 890101029227453
                )
            
                    (select
                        0 as "marker",
                        EvnXml.EvnXml_id as "EvnXml_id",
                        cast (unnest(xpath('data/recommendations/text()', EvnXml.EvnXml_Data)) as text) as "value"
                    from cte
                        inner join v_EvnXml EvnXml on EvnXml.Evn_id = cte.Evn_id
                        left join v_EvnXml CurrEvnXml on CurrEvnXml.EvnXml_id = 0
                    where EvnXml.XmlType_id = 8
                        and (CurrEvnXml.EvnXml_id is null or EvnXml.EvnXml_insDT < CurrEvnXml.EvnXml_insDT)
                        
                         order by EvnXml.EvnXml_Index  DESC 
                    limit 1)
                
