Search code examples
sql-serversql-server-2008sql-server-2008-r2sql-server-2012sql-server-2014

SQL Server Join Order


I use SQL Server and have a query with multiple join.

I want that SQL Server join table A and B in first and then join with table C.

but SQL Server join table B and C in first and then join with table A.

How can I force SQL Server to observe my join order.

Thanks in advance.


Solution

  • You can use the query hint FORCE ORDER.

    From Query Hints (Transact-SQL)

    Specifies that the join order indicated by the query syntax is preserved during query optimization.