On Sunday, June 17, 2012 8:38:48 PM UTC-7, Sean Mackesey wrote:
>
> This would be nice for use with junction tables.  If I have tables a and 
> b, and junction table a_to_b, In SQL I can do:
>
> a_to_b JOIN (a, b) ON (id_a = a.id AND id_b = b.id)
>
> Right now the only way I know to achieve the same effect in Sequel is by 
> chaining two joins:
>
> db[:a].join(db[:a_to_b], :id_a=>:id).join(db[:b] :id=>:id_b)
>
> Is it possible to supply two arguments to a join in Sequel?
>

I don't believe you can get that specific syntax without dropping down to 
raw SQL.  I don't believe the syntax you are using is valid SQL '92, 
anyway, it must be custom syntax your database supports (neither PostgreSQL 
nor SQLite seems to support it).  The SQL '92 way would be to use two 
joins, and that's what Sequel supports (well, you could join to a 
subselect, but you'd have ambiguous column issues then).  Is there a reason 
you don't want to do a separate join per table?

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/X7ARgkiXQ7cJ.
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.

Reply via email to