Let's say that I have 2 tables joining, table A and table B.
I want to compare 2 fields of these tables
table_A.project(Arel.star).join(table_B).where(table_A[:field_1].eq(table_B[:field_1]))
Let's say that I have 2 tables joining, table A and table B.
I want to compare 2 fields of these tables
table_A.project(Arel.star).join(table_B).where(table_A[:field_1].eq(table_B[:field_1]))
To do a join and then compare between fields in different tables, it's best to use the format
tablename.columname
. So,You can use the standard comparison operators with these eg
<=, <, >, >= && <>
(<> means "not equal to" in sql)EDIT: note that i have no idea what is produced by "table_A.project(Arel.star)", this is quite mysterious, so for all i know this might cause an error.