What I like to do instead? Skip the join language: select * from table1, table2, table3 where table1.id = table2.id and table2.id = table3.id. Much cleaner imo.
This is a Pre-SQL 92 style join and is considered legacy and bad practice to use.
The SQL Engine is going to rewrite this to the standard JOIN … ON when it gets a hold of it.
You risk the chance of accidently excluding a join condition in your WHERE clause for a table. This will not throw an error either, it will give you a Cartesian product back instead - giving you bad data.
It displaces the Logical Query Processing flow by putting clauses that are normally run in the FROM phase into the WHERE phase.
Most people you'll find actually consider WHERE table1.id = table2.id harder to read in more complicated queries.
View all comments
Show parent comment
3
u/[deleted] Mar 23 '19 edited Mar 23 '19
This is a Pre-SQL 92 style join and is considered legacy and bad practice to use.
JOIN … ONwhen it gets a hold of it.WHEREclause for a table. This will not throw an error either, it will give you a Cartesian product back instead - giving you bad data.FROMphase into theWHEREphase.WHERE table1.id = table2.idharder to read in more complicated queries.