我如何只提取今天日期的记录,没有其他日期查询 [英] How do i pull only the records for todays date no other day query
本文介绍了我如何只提取今天日期的记录,没有其他日期查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何只提取当天日期的记录,没有其他日期查询
我的查询在下面,但它从前一天拉动记录,如果你能怎样我还可以在时间之前加入数据
SELECT 名称, date , time ,queue FROM sms_traffic_db.table_data WHERE date < = adddate(NOW(),INTERVAL +1天);
解决方案
现在()+ 1天= [昨天,明天](但明天还不存在,所以......)
请查看:
https://dev.mysql.com/doc/refman/5.6/en/date-and-time-functions.html [ ^ ]
您是否尝试过CURDATE
(当前日期=今天)
或者你得到NOW
然后使用DATE
提取查询的当前日期。
从下面的OP评论复制的工作查询更容易发现
query = SELECT名称,日期,时间,队列FROM sms_traffic_db.table_data WHERE date = CURDATE();
<试试这个:
SELECT名称,日期,时间,队列FROM sms_traffic_db.table_data WHERE date = GetDate()
How do i pull only the records for todays date no other day query
my query is below but its pulling records from previous day and if u can how can i also accend the data by the time
SELECT name, date, time, queue FROM sms_traffic_db.table_data WHERE date <= adddate(NOW(), INTERVAL +1 day);
解决方案
Now() + 1 Day = [Yesterday, Tomorrow] (but tomorrow doesn't exist yet, so...)
Have a look to:
https://dev.mysql.com/doc/refman/5.6/en/date-and-time-functions.html[^]
Have you tried theCURDATE
(Current date = today)´
Or you get theNOW
and then use theDATE
to extract the current day for your query.
Working query copied from OP's Comment below to be easier to spot
query = "SELECT name, date, time, queue FROM sms_traffic_db.table_data WHERE date = CURDATE()";
Try this:
SELECT name, date, time, queue FROM sms_traffic_db.table_data WHERE date = GetDate()
这篇关于我如何只提取今天日期的记录,没有其他日期查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文