0

I have this delicious SQL query here that im trying to figure out how to implement in rails using their active record methods ==> .select() .where() ect...

SELECT topics.id FROM topics WHERE NOT EXISTS ( SELECT * FROM votes WHERE votes.topic_id = topics.id )

1 Answer 1

1

Try this

@topics = Topic.where("not exists (SELECT * FROM votes WHERE votes.topic_id = topics.id)") 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.