Whether to use UNION or OR in SQL Server Queries
- by Dinesh Asanka
Recently I came across with an article on DB2 about using
Union instead of OR. So I thought of carrying out a research on SQL Server on what scenarios UNION is optimal in and which scenarios OR would be best.
I will analyze this with a few scenarios using samples taken from the AdventureWorks database Sales.SalesOrderDetail table.
Scenario 1:…