The SQL spec states that explicit joins are performed before implicit joins. This is an implicit join:
FROM table1 t1, table2 t2 WHERE t1.id=t2.t1id
This is an explicit join:
FROM table1 t1 JOIN table2 t2 ON (t1.id=t2.t1id)
This code bit:
categories c
LEFT JOIN photos p
ON p.referencekey = i.key
is an explicit join and is run first. Note that at this point the table aliased as i hasn't been looked at yet, so it can't be joined yet. Note that MySQL fixed this behaviour in 5.2 I believe, and this query will no longer work there either.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…