I would like to write a simple SELECT
statement in SQL Server 2005 which does the following computation with date arithmetic:
Starting from the present date (this means getdate()
), determine the previous Monday, and then subtract 70 days from that Monday, showing in output the resulting date.
How could I achieve this?
My difficulty is mainly to determine the previous Monday.
Of course, if getdate()
is Monday, the previous Monday is getdate()
Thank you in advance for your kind help.
UltraCommit
EDIT: Please note that in Italy the first day of the week is Monday and not Sunday, so if the input is Sunday, July 29th, 2012, the output has to be 23rd July, and not 30th July.