MySql查询根据年份或月份查询

来源:互联网 发布:手机端淘宝店招怎么做 编辑:程序博客网 时间:2024/06/05 03:56
1,根据年份查询对应的数据 如  2011年:select * from  表 where year(字段名)='2011';2,查找指定月份对应的数据: 如  12月:select * from 表 where month(字段名)='12';3,查找天数(本年第二天)对应的数据: 如  本年的第二天:select * from 表 where dayofyear(字段名)='2';

0 0
原创粉丝点击