MySQL Forums
Forum List  »  Optimizer & Parser

Re: Join? Union? I am so lost.
Posted by: Rick James
Date: September 18, 2012 07:48AM

Do you have one row per date in each table?
If not, what do you want to do for dates with a row missing in the other table?

JOIN is for matching up rows in two tables.

LEFT JOIN is similar to JOIN, but it allows for rows to be missing (not matching) in the 'right' table.

UNION is when you want all the rows in one table and all the rows in another table -- each row standing alone (no matching up).

Maybe you need a third table that includes all dates, then two LEFT JOINs -- one to each of your current tables.

Options: ReplyQuote


Subject
Views
Written By
Posted
2166
September 17, 2012 09:09AM
Re: Join? Union? I am so lost.
1147
September 18, 2012 07:48AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.