So I know it is a good programming practice to add the filter conditions in the WHERE clause of a query so as to minimize the number of rows that are returned in the joins but when how do we decide if we should add a filter in the WHERE instead of the FROM? For example:
SELECT a.ColA, a.ColB, a.ColC, b.ColD, b.ColE
FROM TblA a INNER JOIN TblB b
On a.ColA = b.ColD
AND a.ColA = 'X'
AND a.ColB = 'Y'
WHERE b.ColD = 'ABC'
In this query what if I added the b.ColD in the AND clause instead of the WHERE? Will that not make the query more efficient? I know the results could be different in both approaches sometimes but I don't know why?
Thanks.