Is there a difference between doing something like
SELECT *
FROM table1 INNER JOIN table2 ON table2.ObjectId = table1.table2ObjectId
WHERE table2.Value = 'Foo'
vs
SELECT *
FROM table1 INNER JOIN table2
ON table2.ObjectId = table1.table2ObjectId AND table2.Value = 'Foo'
The answer is yes, if there are any. If there are duplicate keys in the tables being joined.
Using an Incomplete ON Condition Unwanted rows in the result set may come from incomplete ON conditions. In some cases, you need to join tables by multiple columns. In these situations, if you use only one pair of columns, it results in duplicate rows.
To use the WHERE clause to perform the same join as you perform using the INNER JOIN syntax, enter both the join condition and the additional selection condition in the WHERE clause. The tables to be joined are listed in the FROM clause, separated by commas. This query returns the same output as the previous example.
Solution. Select column values in a specific order within rows to make rows with duplicate sets of values identical. Then you can use SELECT DISTINCT to remove duplicates. Alternatively, retrieve rows in such a way that near-duplicates are not even selected.
Not with an inner join. An outer join is where placement will make a difference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With