Jump to content

The ultimate community for Ruby on Rails developers.


Photo

SQL to Ruby, Vice Versa

ruby rails database sql

  • Please log in to reply
No replies to this topic

#1 peyterkim

peyterkim

    Passenger

  • Members
  • 2 posts

Posted 06 December 2013 - 07:22 PM

I have 2 tables - Call and Datum. Both have column call_id for association. I want to get all the call_ids from Call which do not also exist in Datum.

The SQL query, I think would be:

 

SELECT call_id FROM Call 

LEFT OUTER JOIN Datum

ON Call.call_id = Datum.call_id

WHERE Datum.id = NULL

 

Let me know if this is wrong. But I need to know what it would look like in Ruby form. Please help!







Also tagged with one or more of these keywords: ruby, rails, database, sql

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users