I am performing a query that selects two times from the exact same table on 2 different columns and performing a compare with the same set of data twice from another table.
My current method:
DELETE FROM MY_TABLE
WHERE MY_TABLE.BUY_ORDER_ID
IN ( SELECT #tmp_table.order_id FROM #tmp_table )
OR MY_TABLE.SELL_ORDER_ID
IN ( SELECT #tmp_table.order_id FROM #tmp_table )
Is there a way to improve on the query?
Thanks
Possibly. Need to test on your data.
If #tmp_table.order_id is the PK or unique then declare it.
Splitting hairs but maybe