When using SQL to access 2 tables, I usually do something like this:
SELECT table1.id, table1.name, table2.value
FROM table1 JOIN table2 ON table1.table2_id = table2.id
WHERE table1.name LIKE 'abc%'
Using a join
to connect the two tables.
However in a project I have taken over I keep encountering this approach:
SELECT table1.id, table1.name, table2.value
FROM table1 as t1, table2 as t2
WHERE t1.table2_id = t2.id AND table1.name LIKE 'abc%'
Where the tables are not joined, but connected together in the where
statement.
In what situations is this approach better than joining
the two tables?