mrkeck Sharing the Love

28Jun/160

mySQL Start of Week on any Day

Needed query to show start of weeks based on Wednesday

DATE_SUB(exampleTimestamp), INTERVAL ( ( DAYOFWEEK(exampleTimestamp) + (6-DAYyouWANT) ) % 7 ) DAY) startOfWeek

0 - Sunday
...
3 - Wednesday
...
6 - Saturday

Filed under: mySQL Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

No trackbacks yet.