In MySQL, how to return the week of the month?

前端 未结 6 1908
独厮守ぢ
独厮守ぢ 2020-12-10 15:17

The year is divided into 12 months. We can break down a month in four weeks.

In MySQL, how to return the week of the month? (Example: first week: 2 entries, second w

6条回答
  •  清歌不尽
    2020-12-10 15:37

    FLOOR((DayOfMonth(dateCol)-1)/7)+1
    

    I'd like to make it clear that this is probably not a good way to divide your data - (see the comments), but that this will get you as close as you can get.

提交回复
热议问题