获取当月总天数+上(几个月)月天数之和
SELECT
(
DATEDIFF(
date_add(
curdate() - DAY (curdate()) + 1,
INTERVAL 1 MONTH
),
DATE_ADD(
curdate(),
INTERVAL - DAY (curdate()) + 1 DAY
)
)
) +(
DATEDIFF(
DATE_ADD(
curdate(),
INTERVAL - DAY (curdate()) + 1 DAY
),
date_add(
curdate() - DAY (curdate()) + 1,
INTERVAL - 你要往前推几个月 MONTH
)
)
)
FROM
DUAL
原文地址:https://www.cnblogs.com/Darkqueen/p/8867068.html
时间: 2024-10-29 20:59:37