Over a million developers have joined DZone.

Nested Queries In Rails

·

Entry.where(:id => Entry.select('max(id) id').arel).to_sql

=> "SELECT     \"entries\".* FROM       \"entries\"  WHERE     (\"entries\".\"id\" IN (SELECT     max(id) id FROM       \"entries\"))"
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}