其他分享
首页 > 其他分享> > 获取指定时间内的周数

获取指定时间内的周数

作者:互联网

SELECT
WEEK (
DATE_FORMAT(
date_add(
DATE_FORMAT(
DATE_ADD(NOW(), INTERVAL - 3 MONTH),
'%Y-%m-%d'
),
INTERVAL (
cast(
help_topic_id AS signed INTEGER
)
) DAY
),
'%Y-%m-%d'
)
) weekInfo
FROM
mysql.help_topic
WHERE
help_topic_id < datediff(
DATE_FORMAT(CURDATE(), '%Y-%m-%d'),
DATE_FORMAT(
DATE_ADD(NOW(), INTERVAL - 3 MONTH),
'%Y-%m-%d'
)
) + 1

GROUP BY weekInfo

标签:-%,help,FORMAT,周数,INTERVAL,指定,topic,获取,DATE
来源: https://www.cnblogs.com/aliRicky/p/14968312.html