I have to create a report that runs every Monday, but pulls data from the previous Sunday to Saturday.
For example: The report ran on Feb 25th, but pulled data from Feb 17th(Sun) to Feb 23rd(Sat).
This is what I have so far, but can't figure out what I need:
Can anyone help me with the correct query?
Thanks,
Ninel
For example: The report ran on Feb 25th, but pulled data from Feb 17th(Sun) to Feb 23rd(Sat).
This is what I have so far, but can't figure out what I need:
Code:
SELECT *
FROM table1
WHERE date >= convert(datetime,convert(varchar(30),getdate() - DATEPART(dw,getdate()), 112) +2)
Can anyone help me with the correct query?
Thanks,
Ninel
