Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/58.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用月号和周号从mysql数据库获取值_Mysql - Fatal编程技术网

使用月号和周号从mysql数据库获取值

使用月号和周号从mysql数据库获取值,mysql,Mysql,是否可以使用月号和周号从表中检索记录 例如,我有一张桌子 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

是否可以使用月号和周号从表中检索记录 例如,我有一张桌子

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 
如果问题不清楚,请回答 谢谢

您可以使用月和周功能


它使用月功能,但即使在工作日,也不能在周中工作。op需要月中的周,而不是年中的周@草莓周是像2016年6月一样的周数,从周日开始有5周。事实上,我正在从PHP计算周数,并将其传递给mysql查询。你是说5月29日星期日?看看mysql中给出的一年中周数的标准的一些外观。它可以使用多种模式。
select * from table where month(`date`) = 6 and week(`date`) = 1