Hello and welcome @rapphann ![]()
I’m afraid I’m not a SQL master either
But I would think it would be something like this:
SELECT us.user_id, current_timestamp AS granted_at
FROM user_stats AS us
WHERE us.likes_received >= 100
AND us.likes_given >= 100
AND (:backfill OR us.user_id IN (:user_ids))