mysql查询以显示特定月份所有日期的记录 [英] mysql query to display the records of all the days in a particular month

查看:1347
本文介绍了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;


这篇关于mysql查询以显示特定月份所有日期的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆