On Thursday, May 17, 2012 7:24:19 AM UTC-7, Kartik Rustagi wrote:
>
> While doing a join over 2 tables A(a,b) and B(a,d) I use the following 
> syntax:
> A.join(B, a=>a).select(A__a,b,d)
>
> Here to avoid ambiguity I use A__a, but as I side effect of this I have to 
> mention every other column as well. This becomes a little inconvenient when 
> two tables having many many columns but only 1 common column which is also 
> the join condition and to do such a select in which I get all the columns 
> of both tables but just one entry for the join condition I have to mention 
> each column explicitly select statement. Is there a way to avoid this 
> mentioning of each column in both table and still getting the required 
> select?
>

Assuming the database supports it, you can use JOIN USING instead of JOIN 
ON:

  A.join(B, [a]).select(a,b,d)

I'm not sure where the ambiguity comes from, though.  If you just do

  A.join(B, a=>a)

It should select all columns in both tables.  Which database are you using?

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/-/ZINRlnDjBcoJ.
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