CREATE VIEW dbo.ApiWorkersAbsences as
select top 100 percent n.Zrodlo WorkerId, d.Nazwa Name,  n.OkresFrom DateFrom, n.OkresTo DateTo from dbo.Nieobecnosci n
JOIN dbo.DefNieobecnosci d ON d.ID = n.Definicja
where n.ZrodloType='Pracownicy'
ORDER BY n.OkresTo DESC