Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can you 'force' a join order?
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00777788
Message ID:
00777803
Views:
17
Hi Thom,

You can do that using
OPTION (FORCE ORDER)
query hint but it's not recomended because query optimizer usually selects the best execution plan. See BOL for details.

>To all,
>
>In Visual FoxPro, you can "force" the order in which a set of tables are joined. For example, with a hierarchicaly structured set of tables (say the classic Customers, Order, Line Items) you can force the order in which the tables are joined:
>
>SELECT * ;
>FROM Line_Items ;
>WHERE li_OrderNum IN ;
>(SELECT O.or_OrderNum ;
>FROM FORCE Customers C ;
>INNER JOIN Order O ;
>ON O.or_CustNum = C.cs_CustNum ;
>WHERE C.cs_CustName = 'FRED')
>
>In this example, the join order of the sub select starts with Customers
>(which is filtered) and goes to the Order table.
>
>With larger queries, I've seen a 25% improvement in performance using the VFP "FORCE" clause.
>
>Does T-SQL have an analog to VFP's 'FORCE' clause?
>
>Regards,
>Thom C.
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform