View Single Post

  #3 (permalink)  
Old 04-19-2008
Paul Lautman
 
Posts: n/a
Default Re: select all different fields but only one for the common in join

Rik Wasmus wrote:
> On Sat, 19 Apr 2008 12:34:12 +0200, avilella <avilella@gmail.com>
> wrote:
>> Hi,
>>
>> I want to do a join for 4 tables on field "id" and "type" but I only
>> want to have "id" and "type" shown once, then have all the other
>> fields, that are unique in the table, also shown. Something like:
>>
>> select // id and type once, then all fields
>> from table_11 t1, table_12 t2, table_21 t3, table_22 t4
>> where t1.id=t2.id and
>> t2.id=t3.id and
>> t3.id=t4.id and
>> t1.type=t2.type and
>> t2.type=t3.type and
>> t3.type=t4.type limit 5
>>
>> Any ideas?

>
> Just name them explicitly?


As Rik said and use explicit JOINs for clarity and reliability


Reply With Quote