I am joining two tables. The first contains work orders and their associated part numbers. The second contains the BOM for all of the part numbers. They are both large tables. Individually, I can query the two tables in seconds if not less. When I perform the join, it takes minutes. Is it possible that the where at the end of this statement is being performed after the join? If the join is performed first, I could see this taking a long time. But if the first table is reduced first by the where, I would think this should go fast. Is there someway to write a more optimized query?
SELECT Table2.ItemNum As ItemNum
FROM Table1
INNER Join Table2
ON Table1.PartNum = Table2.PartNum
WHERE Table1.WorkOrder = 10100314
Table1.WorkOrder? On thePartNumfields?