MySql中的数据过滤问题。 [英] Data filter problem in MySql.
本文介绍了MySql中的数据过滤问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有datetime数据类型,如果mysql数据库以格式同时输入日期和时间
yyyy / MM / dd HH:mm:ss例如2013-09-07 14:33:00
数据正在成功保存,当我在选择查询过滤器中按日期检索yyyy / MM / dd
它不返回任何记录。如何编写选择查询来过滤两个日期之间的数据。
我的查询到这里...
i have datetime datatype if mysql database to dave date and time simultaneously in the Format
yyyy/MM/dd HH:mm:ss eg 2013-09-07 14:33:00
The data is being saved succesfully, when i retrieve it in select query filter by date yyyy/MM/dd
it returns no records. how to write the Select Query to filter data between two dates.
My Query Goes here...
string str = "select IFNULL( max(complain_no),0) FROM call_log WHERE complain_date = '" + DateTime.Now.ToString("yyyy/MM/dd") + "'";
推荐答案
这就是你要写的方式。
This is how you have to write.
select IFNULL( max(complain_no),0) FROM call_log WHERE date_format(complain_date,'%Y-%m-%d') = '" + DateTime.Now.ToString("yyyy-mm-dd") + "'";
这篇关于MySql中的数据过滤问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文