Where should i put the filters on a tsql query
SELECT a.colum FROM A
JOIN B ON A.ID = B.ID AND B.STATUS = 1
OR
SELECT a.colum FROM A
JOIN B ON A.ID = B.ID
WHERE B.STATUS = 1
Im looking for performance issues or good practices.
|
Where should i put the filters on a tsql query
OR
Im looking for performance issues or good practices. |
|||||||||
|
Note: This changes for OUTER JOINs because you'd change it to a inner join The quick way:
With separate filters:
|
||||
|
|
|
It depends. You need to look at the execution plan for your specific queries and see which query is using the more efficient plan. With queries as simple as your example the plans will probably look pretty similar. The more complex the query the more difference you will see in the plan. |
|||
|