I have two tables (Product and Category).
Product has 2 columns: Product_temp_category_id and
Category has 2 columns: Category_id and Category_default (int)
I'm trying to improve this query. Overall it is updating the Product table
with a final_category_id (from Category.Category_default) if
Product_final_category_id IS NULL
I have an index on Product_temp_category_id and on Category.Category_id but
it is not using them.
UPDATE Product SET Product_final_category_id= (SELECT TOP 1 Category_default
FROM Category WHERE Product .Product_temp_category_id =
Category.Category_id) WHERE Product_final_category_id IS NULL