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?
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 ==================
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?
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 ==================