选择日期之间的mysql查询?

2021-11-20 00:00:00 date select mysql

如何从过去日期到当前日期的mysql表中选择数据?例如,选择从 2009 年 1 月 1 日到当前日期的数据??

How to select data from mysql table past date to current date? For example, Select data from 1 january 2009 until current date ??

我的datetime"列是 datetime 日期类型.请帮忙,谢谢

My column "datetime" is in datetime date type. Please help, thanks

如果说我想获取 2009 年 1 月 1 日起的每日数据,如何编写查询?使用 count 和 between 函数?

If let say i want to get day per day data from 1 january 2009, how to write the query? Use count and between function?

推荐答案

select * from *table_name* where *datetime_column* between '01/01/2009' and curdate()

或使用 >=<= :

select * from *table_name* where *datetime_column* >= '01/01/2009' and *datetime_column* <= curdate()

相关文章