
                
                
                SELECT 
                WG.WorkGraph_id as "WorkGraph_id",
                COALESCE(MSF.Person_SurName, '') as "Person_SurName",
                COALESCE(MSF.Person_FirName, '') as "Person_FirName",
                COALESCE(MSF.Person_SecName, '') as "Person_SecName",
                COALESCE(to_char(WG.WorkGraph_begDT, 'DD.MM.YYYY'), '') as "WorkGraph_begDate",
                COALESCE(to_char(WG.WorkGraph_endDT, 'DD.MM.YYYY'), '') as "WorkGraph_endDate",
                COALESCE(PUC.PMUser_Name, '') as "PMUser_Name",
                '' as "WorkGraph_Sections"
            
                FROM
                
                v_WorkGraph WG
                left join v_MedStaffFact MSF  on MSF.MedStaffFact_id = WG.MedStaffFact_id
                left join v_pmUserCache PUC  on PUC.PMUser_id = WG.pmUser_insID
                
                INNER JOIN LATERAL(

                    select WGLS.WorkGraphLpuSection_id
                    from v_WorkGraphLpuSection WGLS
                    inner join v_LpuSection LS  on (LS.LpuSection_id = WGLS.LpuSection_id and LS.LpuBuilding_id = 450101000000410)
                     and  WGLS.LpuSection_id = 450101000004450
                    where WGLS.WorkGraph_id = WG.WorkGraph_id
                ) B on true
            
             WHERE 
            (1=1)
             and MSF.Lpu_id = '25'
            
                
                        ORDER BY
                            
            WG.WorkGraph_begDT desc
            
                OFFSET 0 ROWS
                FETCH NEXT 100 ROWS ONLY
                
