我需要在当月第一天和当日之间从MySQL数据库中选择数据。
select*from table_name where date between "1st day of current month" and "current day"
有人可以提供此查询的工作示例吗?
select * from table_name where (date between DATE_ADD(LAST_DAY(DATE_SUB(CURDATE(), interval 30 day), interval 1 day) AND CURDATE() )
或更好 :
select * from table_name where (date between DATE_FORMAT(NOW() ,'%Y-%m-01') AND NOW() )