MySQL – Joining Tables without Join Keyword

Here is another micro post…

I used to use JOIN keyword whenever a table join was necessary in MySQL, but recently I have been using this other method of joining tables in MySQL (it should be applicable in MSSQL too). In this method you don’t need to say JOIN in your query.

Consider this example where you say “JOIN” to join 2 tables:

SELECT * FROM table1 INNER JOIN table2 ON table1.id=table2.id;

You can join these tables without ever saying INNER JOIN or JOIN as below:

Select * from table1 t1, table2 t2 where t1.id = t2.id; //t1 and t2 are just aliases (shorthands) to refer to table1 and table2

Simple as that. Recently it just feels more natural to me 🙂

Hope this helps.
Use recyclable materials.
Serdar

Leave a Reply

Your email address will not be published. Required fields are marked *