Search code examples
sqljoinequals

SQL JOIN: ON vs Equals


Is there any significant difference between the following?

SELECT a.name, b.name FROM a, b WHERE a.id = b.id AND a.id = 1

AND

SELECT a.name, b.name FROM a INNER JOIN b ON a.id = b.id WHERE a.id = 1

Do SO users have a preference of one over the other?


Solution

  • There is no difference, but the readability of the second is much better when you have a big multi-join query with extra where clauses for filtering.
    Separating the join clauses and the filter clauses is a Good Thing :)