Hello,

What's the best/easiest way to write this delete statement using 
ActiveRecord 3.1?

DELETE e1
  FROM events e1
  JOIN events e2
 WHERE e1.subject_type = e2.subject_type
   AND e1.subject_id   = e2.subject_id
   AND e1.origin_type  = e2.origin_type
   AND e1.origin_id    = e2.origin_id
   AND e1.id > e2.id


Thanks for the help.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/oRQomT29TboJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to