In SQL I am trying to filter results based on an ID and wondering if there is any logical difference between
SELECT value
FROM table1
JOIN table2 ON table1
I think answer marked as "right" is not right. Why? I try explain:
We have opinion
"Always keep the Join Conditions in ON clause Always put the filter's in where clause"
And this is wrong. If you are in inner join, every time put filter params in ON clause, not in where. You ask why? Try imagine complex query with total of 10 tables(f.e. every table has 10k recs) join, with complex WHERE clause(for example, functions or calculations used). If you put filtering criteria in ON clause, JOINS between these 10 tables not occurs, WHERE clause will not executed at all. At this case you are not performing 10000^10 calculations in WHERE clause. This make sense, not putting filtering params in WHERE clause only.