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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.