SQL SELECT mit dynamischer Selektion vom Datum
BEISPIEL 1
SELECT *
FROM [DataWarehouse].[fct].[MaterialDocumentSegment]
WHERE SourceSystem = 'M' and
(MovementType between '687' and '688' or MovementType between '601' and '602') and
SpecialStock <> 'T' and
year(DocumentPostingDate) >= year(getDate())-2
BEISPIEL 2
WHERE [TIMESTAMP] is not null and TRY_CAST([TIMESTAMP] as date) >= getDate()-90