Relationship between multiple JOINs

If I have a sequence of multiple JOINs in a MySQL query, such as

1. SELECT * FROM x 
2.    LEFT JOIN y ON x.id = y.id; 
3.    LEFT JOIN z ON x.id z.id 
4. ... 

Is each individual left join applied to what results from SELECT in line 1, or is the query processed in such a way that the first left join is applied to the results of SELECT and the second left join to the results of the preceding left join? Thanks

Answers


Your JOIN rule is declared exactly by your ON clause. I.e. your question have no sense - you have a clear declaration that you're joining table x with y and table x with z. If you query would look like:

SELECT * FROM x 
LEFT JOIN y ON x.id = y.id
LEFT JOIN z ON y.id z.id 

then it will be x -> y -> z join - see that it is declared in ON y.id = z.id. Your current query represent z <- x -> y join.

You can see description of SQL JOIN here.


Need Your Help

Shopify verify webhook call in Scala

scala playframework-2.0 shopify sha256

I'm implementing a simple web service for a Shopify webhook to call using Play2. I want to verify the call is from Shopify using the 'X-Shopify-Hmac-Sha256' header parameter included.

Facebook notification on third party software

php facebook

Is there a fb api that allows user to get fb notification or latest wall post by friend on their own website? this means that the software will requires user fb credential.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.