Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SELECT DISTINCT users.*, (SELECT COUNT(p.*) FROM pokes p WHERE p.user_id = users.id AND p.campaign_id = 3) as pokes_count FROM "users" INNER JOIN "pokes" ON "pokes"."user_id" = "users"."id" WHERE (pokes.campaign_id = 3) ORDER BY RANDOM() LIMIT 8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.