2016-06-25 4 views
0

は、それが月を使用して、テーブルからレコードを取得することは可能ですがないと週何 ない例えば質問はしてください明確でない場合、私はテーブルのgetなしの月を使用して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   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

「週」とは何ですか? – Strawberry

+0

@ストロベリーウィークは、日曜日から始まる5週間を持つ2016年6月のような週のノーである。実際には私はPHPから週の数を数えているとmysqlクエリに渡す –

+0

あなたは5月29日日曜日を意味する? – Strawberry

答えて

-1

monthweekの機能を使用できます。 Documentation here

select * from table where month(`date`) = 6 and week(`date`) = 1 
+0

平日(平日)の場合でも週機能で動作しますが、週機能は動作しません。 –

+0

オペラが週を望み、週を希望しない – Strawberry

関連する問題