SELECT user_id, current_timestamp AS granted_at
FROM gamification_scores
WHERE (:backfill OR user_id IN (:user_ids))
GROUP BY 1
HAVING SUM(score) > 9000
该查询是否可以按年、月或三个月进行限制?
SELECT user_id, current_timestamp AS granted_at
FROM gamification_scores
WHERE (:backfill OR user_id IN (:user_ids))
GROUP BY 1
HAVING SUM(score) > 9000
该查询是否可以按年、月或三个月进行限制?
我认为你可以添加类似以下内容:
SELECT user_id, CURRENT_TIMESTAMP AS granted_at
FROM gamification_scores
WHERE date >= CURRENT_DATE - INTERVAL '1 MONTH'
AND user_id > 0
AND (:backfill OR user_id IN (:user_ids))
GROUP BY 1
HAVING SUM(score) > 1000
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.