mysql 查询年数据

mysql 怎么查询一年的数据
select * from 表 where date_format(日期,'%Y-%m-%d')='2014-04-01' 日期
select * from 表 where date_format(日期,'%Y-%m')='2014-04' 月份
select * from 表 where date_format(日期,'%Y')='2014' 年

就是date_format(日期,'%Y-%m-%d') 这里的参数长短

发布了75 篇原创文章 · 获赞 9 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/zy1471162851/article/details/102464978