MySql查询语句根据年份或月份查询
1. 按年份查询
select 字段名 from 表 where year(字段名)='年份';
2. 按月份查询:
select 字段名 from 表 where month(字段名)='月份';
3. 查本年的某一天(例本年的第6天)
select 字段名 from 表 where dayofyear(字段名)='6';
1. 按年份查询
select 字段名 from 表 where year(字段名)='年份';
2. 按月份查询:
select 字段名 from 表 where month(字段名)='月份';
3. 查本年的某一天(例本年的第6天)
select 字段名 from 表 where dayofyear(字段名)='6';