暂无图片
暂无图片
5
暂无图片
暂无图片
暂无图片

mysql语句之-一列中连续的日期

原创 游湖 2022-12-11
435

select * from (
select a.assigned_date date,ifnull(b.nn,0) kwtimes from
(select assigned_date
from
(select adddate('2020-01-01',t3.i*1000 + t2.i*100 + t1.i*10 + t0.i) assigned_date
from
(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t0,
(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t1,
(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t2,
(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t3
) c
where assigned_date between (select min(date(time)) from pushdata) and NOW()) a
left join (select date(time) as date,count(*) nn from pushdata where (select @kw:='数字货币') or app like concat('%',@kw,'%') or title like concat('%',@kw,'%') or content like concat('%',@kw,'%') group by date) b
on a.assigned_date=b.date
) d
where date>=(select min(date(time)) from pushdata where app like concat('%',@kw,'%') or title like concat('%',@kw,'%') or content like concat('%',@kw,'%'))

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论