sql语句如何对日期进行模糊查询

今天在做自己的博客时需要每个日期段发表的博文数目,需要对博文发表的日期段进行查询,这里有两种方法可用
1.like方法

String str="2017-1";
select * from Blog where publishDate like '%"+str+"%'

2.between and

from Blog where publishDate between ' 2019-03-01-00 00:00:00' and '2019-03-31 23:59:59'

猜你喜欢

转载自blog.csdn.net/rj2017211811/article/details/88386159