1.查询2019年的数据:
select test.* from product test where year(test.createTime)=‘2019’
2.查询9月份的数据:
select test.* from product test where month(test.createTime)=‘09’
3.查询2019年9月份的数据:
select test.* from product test where year(test.createTime)=‘2019’ and month(test.createTime)=‘09’
注意:year和month后面的括号里面放"某表某字段(时间)"