今天在做自己的博客时需要每个日期段发表的博文数目,需要对博文发表的日期段进行查询,这里有两种方法可用
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'
今天在做自己的博客时需要每个日期段发表的博文数目,需要对博文发表的日期段进行查询,这里有两种方法可用
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'