Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def self.funders_or_sponsors(opts={})
find_by_sql <<-SQL
SELECT *
FROM (
(SELECT "users".* FROM "users" WHERE "users"."sponsor" = 't')
UNION
(SELECT DISTINCT "users".* FROM "users" INNER JOIN "successful_transactions" ON "successful_transactions"."user_id" = "users"."id")
) AS t
SQL
end
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.