select AC.ID, max(AC.Code) as Code, max(AC.Name) as Name from assetdepreciations AD
left join assetcards AC on AC.id = AD.parent_id
where
(AD.OrdNumber > 0) and
(
(AD.VirtualPeriod_ID is null) or
(AD.VirtualPeriod_ID = '0000000000')
) and
(select Period_ID from AssetGetPeriodID(AD.D_Month, AD.d_Year)) is not null
group by AC.IDGenerated by ABRA Software a.s. 27.10.2021 16:34:23