是否可以使用月号和周号从表中检索记录 例如我有一张桌子
CustomerID CustomerName date(data type date)
1 sam 2016-06-1
2 dam 2016-06-2
3 kam 2016-06-8
4 ram 2016-06-9
4 ram 2016-07-8
how can i retrieve the month no 6 and week no 1 records
after the select query expected result is
CustomerID CustomerName date
1 sam 2016-06-1
2 dam 2016-06-2
it will give 2 records because date 1 and 2 fall under first week
如果问题不明确请回复 谢谢!
答案 0 :(得分:-1)
您可以使用month
和week
功能。 Documentation here
select * from table where month(`date`) = 6 and week(`date`) = 1