irb(main):001:0> require 'sequel'; DB = Sequel::sqlite; DB.quote_identifiers = false => false
irb(main):002:0> ids = DB[ "SELECT 1 AS o_id, 2 AS m_id" ].as( :ids ) => #<Sequel::SQL::AliasedExpression:0x401fa0 @expression=#<Sequel::SQLite::Dataset: "SELECT 1 AS o_id, 2 AS m_id">, @aliaz=:ids> irb(main):003:0> DB.dataset.from( ids ).left_outer_join( DB [:objects].as(:objects), :id=>:o_id ).left_outer_join( DB[:methods].as (:methods), :id=>:m_id ).sql => "SELECT * FROM (SELECT 1 AS o_id, 2 AS m_id) AS 'ids' LEFT OUTER JOIN (SELECT * FROM objects) AS 'objects' ON (objects.id = ids.o_id) LEFT OUTER JOIN (SELECT * FROM methods) AS 'methods' ON (methods.id = objects.m_id)" Note at the end "objects.m_id" instead of "ids.m_id". Is the best way to fix this just to be explicit for every join after the first, e.g. :id=>:ids__m_id? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sequel-talk" group. 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/sequel-talk?hl=en -~----------~----~----~----~------~----~------~--~---
