set @i = -1; set @sql = repeat(" select 1 union all",-datediff('2021-01-01','2030-12-31')+1); set @sql = left(@sql,length(@sql)-length(" union all")); set @sql = concat("select date_add('2021-01-01',interval @i:=@i+1 day) as date
baidu出来的结果多是下面答案:<quote> MySQL中,如何查询两个日期之间的记录,日期所在字段的类型为datetime(0000-00-00 00:00:00) 解决方案: 直接使用><=就可以查询. where createDate<'2003-5-31' and createDate>'2003-2-30'; </quote>其实简单美好的写法可以是这样...WHERE LogTime BETWEEN '2010-08-01' AND '201