SQLTeam.com | Weblogs | Forums

Return Week Commencing Date (Monday) for a time stamped field

Good Morning!

My first post and I'm a super super new SQL user.

My current script is:
SELECT ActivityDate, RecordCount FROM Database

I want to be able to add in another field that returns the Week Commencing date (the Monday) of the ActivityDate. The ActivityDate could be any day of the week but I want to be able to amalgamate the RecordCounts into weeks.

I must have tried several examples on forums but ALL return the Sunday date, not Monday.
Frustratingly my SQL knowledge is very limited and I'm struggling to manually amend any of the given formulas to suit my requirement.

Can anybody help? Pretty please!
Thank you,
Laura

Thank you anyone who viewed my query but I managed to solve it!!

DATEADD(day, DATEDIFF(day, 0, ActivityDate) /7*7, 0) AS WeekStart

Thank you :slight_smile: