SQL Query to return records from Monday this week

Kayleigh

Member
Local time
Today, 12:00
Joined
Sep 24, 2020
Messages
709
Hi
I'm looking to write a query in SQL server (which I am converting to PT for Ms Access). It should be returning all records which were created this week ie since Monday. I have searched for the best way to do this but have not found a satisfactory solution. Any ideas please?
 
did you check this out:
sql - Previous Monday & previous Sunday's date based on today's date - Stack Overflow

in access this can be achieved by:
Code:
Public Function DatePrevWeekday( _
  ByVal datDate As Date, _
  Optional ByVal bytWeekday As VbDayOfWeek = vbMonday) _
  As Date

' Returns the date of the previous weekday, as spelled in vbXxxxday, prior to datDate.
' 2000-09-06. Cactus Data ApS.

  ' No special error handling.
  On Error Resume Next

  DatePrevWeekday = DateAdd("d", 1 - Weekday(datDate, bytWeekday), datDate)

End Function
 

Users who are viewing this thread

Back
Top Bottom