Hi there,
Anyone knows how to use a scope with a table alias condition like:
SELECT *
FROM table_name
AS alias_name, alias_name2
Where alias_name.field = alias_name2.field
Or if anyone has other suggestion…
Thank you
Hi there,
Anyone knows how to use a scope with a table alias condition like:
SELECT *
FROM table_name
AS alias_name, alias_name2
Where alias_name.field = alias_name2.field
Or if anyone has other suggestion…
Thank you
Maybe this is the sort of thing you’re looking for?
–
Chris
http://livingsocial.com | http://clabs.org
Hi there Chris, i already found a solution, but thanks anyway. I need
to check from 2 table entries where they have a field in common.
Here’s the snippet:
User.from("Users as u1, Users as u2).where(“u2.LastName=u1.LastName AND u1.id !=
u2.id”)
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs