Mysql SQL查询以查找特定日期提出的问题数

Mysql SQL查询以查找特定日期提出的问题数,mysql,sql,Mysql,Sql,日期问题数目 2015-08-25 3 2015-08-26 8 2015-06-27 13 2015-06-28 35 我不是mysql的专家。根据我的要求,我想知道在某一天提出的问题的数量。当我执行上面的查询时,我会得到上面这样的结果 如何仅获取当前日期(即2015-06-28)的结果?而不是分组依据使用其中条件如下: select Date(createdOn) Date, count(createdOn) "No of Questions" from Questions group

日期问题数目

2015-08-25 3

2015-08-26 8

2015-06-27 13

2015-06-28 35

我不是mysql的专家。根据我的要求,我想知道在某一天提出的问题的数量。当我执行上面的查询时,我会得到上面这样的结果


如何仅获取当前日期(即2015-06-28)的结果?

而不是
分组依据
使用
其中
条件如下:

select Date(createdOn) Date, count(createdOn) "No of Questions" 
from Questions 
group by Date(createdOn);
select Date(createdOn) `Dated`, count(createdOn) "No of Questions" 
from Questions 
where Date(createdOn) = CURDATE();
务必检查是否有CURDATE()的特定数据,即2015-08-28 eles请尝试以下方法:

select Date(createdOn) Date, count(createdOn) "No of Questions" 
from Questions 
group by Date(createdOn);
select Date(createdOn) `Dated`, count(createdOn) "No of Questions" 
from Questions 
where Date(createdOn) = CURDATE();
试试这个:

select Date(createdOn) `Dated`, count(createdOn) "No of Questions" 
from Questions 
where Date(createdOn) = '2015-08-26';
你可以用
其中CONVERT(DATE,GETDATE())=CONVERT(DATE,@YourDate)

它给出了类似错误1064(42000)的错误:您的SQL语法有错误;检查与您的MySQL服务器版本对应的手册,以了解在第行的“Date(createdOn)Date,count(createdOn)”附近使用的正确语法1@BhupatiPatel:-更新了我的答案。现在检查!很抱歉,我得到的是空0。@bhupatitel:-您的表中有当前日期(即2015-08-28)的数据吗?谢谢@Rahul,再次验证。我现在得到了正确的结果。为什么要使用分组方式,然后有一个简单的什么地方可以解决这个问题呢?;)我之前尝试过这一点,它给出了类似于错误1054(42S22)的错误:“having子句”中的未知列“createdOn”btw YourDate将类似于DECLARE@YourDate=new DATE('20150827')