f



LEFT + LEFT vs LEFT + RIGHT

In order to do a full outer join in MySQL one must use a union.
Is there any good reason to do

SELECT ...
LEFT JOIN

UNION

SELECT ...
RIGHT JOIN

rather than

SELECT ...
LEFT JOIN

UNION

SELECT ...
LEFT JOIN
with the tables swapped on the latter LEFT JOIN? 


0
paul.lautman (522)
5/27/2006 9:37:09 AM
comp.databases.mysql 6944 articles. 1 followers. laredotornado (869) is leader. Post Follow

3 Replies
659 Views

Similar Articles

[PageSpeed] 48

Paul Lautman wrote:
> In order to do a full outer join in MySQL one must use a union.
> Is there any good reason to do
> 
> SELECT ...
> LEFT JOIN
> 
> UNION
> 
> SELECT ...
> RIGHT JOIN
> 
> rather than
> 
> SELECT ...
> LEFT JOIN
> 
> UNION
> 
> SELECT ...
> LEFT JOIN
> with the tables swapped on the latter LEFT JOIN? 
> 
> 

You mean other than the obvious fact the columns will be swapped in the two results?

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
0
jstucklex (14659)
5/27/2006 11:00:52 AM
Jerry Stuckle wrote:
> Paul Lautman wrote:
>> In order to do a full outer join in MySQL one must use a union.
>> Is there any good reason to do
>>
>> SELECT ...
>> LEFT JOIN
>>
>> UNION
>>
>> SELECT ...
>> RIGHT JOIN
>>
>> rather than
>>
>> SELECT ...
>> LEFT JOIN
>>
>> UNION
>>
>> SELECT ...
>> LEFT JOIN
>> with the tables swapped on the latter LEFT JOIN?
>>
>>
>
> You mean other than the obvious fact the columns will be swapped in
> the two results?

Doesn't that depend on what is in the SELECT part of the statement? 


0
paul.lautman (522)
5/27/2006 11:35:08 AM
Paul Lautman wrote:
> Jerry Stuckle wrote:
> 
>>Paul Lautman wrote:
>>
>>>In order to do a full outer join in MySQL one must use a union.
>>>Is there any good reason to do
>>>
>>>SELECT ...
>>>LEFT JOIN
>>>
>>>UNION
>>>
>>>SELECT ...
>>>RIGHT JOIN
>>>
>>>rather than
>>>
>>>SELECT ...
>>>LEFT JOIN
>>>
>>>UNION
>>>
>>>SELECT ...
>>>LEFT JOIN
>>>with the tables swapped on the latter LEFT JOIN?
>>>
>>>
>>
>>You mean other than the obvious fact the columns will be swapped in
>>the two results?
> 
> 
> Doesn't that depend on what is in the SELECT part of the statement? 
> 
> 

Yes, but trying to swap them between the select and join clauses can become very 
confusing.

Much clearer to keep everything in the same order.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
0
jstucklex (14659)
5/27/2006 11:50:28 AM
Reply: