Crystal Reports & SQL Reporting Services Training Consultants
Account Log in:
Username:
Password:
Don't go looking for trouble
 
Institute of IT Trainers - Freelance Trainer of the Year 2006 & 2009
Liverpool Business Connect Member
  Maximum Impact Solutions Limited - Reporting Solutions, Creating Answers
Reporting Solutions - Creating Answers, Crystal Reports, Dashboarding (Xcelsius) & SQL Reporting Services

The Maximum Impact Solutions Blog Feed ME!!!!

10
December

How Do I return the 4 weeks data starting from the Previous Friday date in SQL?

One of my clients, wanted to know the SQL script, to return data from the previous 4 weeks, from the last Friday

Solution:

--SET DATEFIRST 6;

SELECT  DATEADD(DAY, -DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE))as [Previous Friday],

DATEADD(WEEK,-3, DATEADD(DAY, -DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE))) as [4 Fridays Ago]


If you have any questions, leave us a comment below, or need any assistance, please do not hesitate to Contact Us
1

Joolz

21
April
Thanks that was really helpful!

MAKE A COMMENT

Name *

Email Address *

Comment *

To prove you are human what is:

64 + 41 =