WITH RECURSIVE dates AS ( SELECT "2021-12-01" AS date UNION ALL SELECT date + INTERVAL 1 DAY FROM dates WHERE date < "2023-03-27" ) SELECT DATE_FORMAT(dates.date, '%Y-%m-%d') AS date, IFNULL(COUNT(skins_logs.created_at), 0) AS count FROM dates LEFT JOIN skins_logs ON DATE(skins_logs.created_at) = dates.date AND skins_logs.skins_id = 481 WHERE dates.date BETWEEN "2021-12-01" AND "2023-03-27" GROUP BY dates.date;
时间: 2024-04-21 07:30:01 浏览: 111
pixel-recursive-super-resolution-master.zip_Super-Resolution_bre
这是一段SQL查询语句,使用了递归CTE(公共表表达式)来生成一个日期序列,然后将该序列与表skins_logs进行左连接,并按日期分组计算每个日期在skins_logs表中的记录数。
具体来说,这个查询语句返回一个包含日期和该日期中与skins_id为481相关的skins_logs记录数的结果集。
阅读全文