mysql查询以显示特定月份所有日期的记录

问题描述:

朋友,

Mysql查询使用for循环显示特定月份的所有日期的记录,这意味着它必须从该月的开始日期开始并在该特定月份的结束日期结束.如果我将参数传递为August,则必须使用2011-08-01,2011-08-02,.......... 2011-08-31表中的记录.我该如何对此查询编写?有人可以帮忙吗?

Hi Friends,

Mysql Query to display the records of all the days in a particular month using for loop means it has to start from starting day of the month and ends at the ending day of that particular month.If i passed the parameter as August it has to take the records from 2011-08-01,2011-08-02,..........2011-08-31 tables.How can i write a query for this.Can any one help me.

它可以更简单:

SELECT * FROM TABLE WHERE MONTH(TABLE.DATEFIELD)= 8并YEAR(TABLE.DATEFIELD)= 2011;
It can be more simple:

SELECT * FROM TABLE WHERE MONTH(TABLE.DATEFIELD) = 8 and YEAR(TABLE.DATEFIELD) = 2011;