Home > database >  Date query 14 days forwards and backwards
Date query 14 days forwards and backwards

Time:08-12

Hello I have a simple query but I would like to see 14 days forward and back with today's date. How can I do that?

The query is :

SELECT gut_pri as summe 
FROM [hydra1].[hydadm].[v_ade_protokoll] 
WHERE masch_nr= 'FIMI3'
AND anmeld_dat = DATEADD(day, -0, convert(date, GETDATE()))

Thank you in advance.

Rene

CodePudding user response:

SELECT gut_pri as summe 
 FROM [hydra1].[hydadm].[v_ade_protokoll] 
 WHERE masch_nr= 'FIMI3'
  and anmeld_dat BETWEEN DATEADD(DD,-14 GETDATE())AND DATEADD(DD,14 GETDATE())

Something like this ?

  • Related