You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When doing a sub-query with current table, then it is not possible to compare fields from inner and outer query. This is very useful when trying to create a scope for maximum of group type of queries.
I also played with table = BabySqueel[:proxy_configs].alias(:versions), create_table_alias and from to no avail. So I'm curious about non baby_squeel solutions too. The only thing that I made working was direct SQL
where('NOT EXISTS (SELECT 1 FROM proxy_configs AS pc where proxy_configs.environment = environment AND proxy_configs.proxy_id = proxy_id AND proxy_configs.version < version)')
akostadinov
changed the title
subqueries with same table impossible
subqueries comparing with same table impossible
Mar 24, 2022
Issue
When doing a sub-query with current table, then it is not possible to compare fields from inner and outer query. This is very useful when trying to create a scope for maximum of group type of queries.
Reproduction
The text was updated successfully, but these errors were encountered: