#方法一
SELECT
count(DISTINCT(id)) ,
count(DISTINCT(pid))
FROM
push_platform_upd
WHERE
datediff(NOW(), last_dt) <= 30
#方法二
SELECT
count(DISTINCT(id)) ,
count(DISTINCT(pid))
FROM
push_platform_upd
WHERE
last_dt >= DATE_SUB(
DATE_FORMAT(NOW(), '%Y-%m-%d'),
INTERVAL 30 DAY
)