If you have a query that is like so is there a better approach? Is there an alternate way to handle all of the “OR” statements? Just trying to figureout a way to get rid of all of the “ORs”
Version: SQL Server 2008 R2
Select ProductID
From product.Products
Where
(Attribute1 <> 0
or Attribute2 <> 0
or Attribute3 <> 0
or Attribute4 <> 0
or Attribute5 <> 0
or Attribute6 <> 0
or Attribute7 <> 0
or Attribute8 <> 0
)
AND
(CatAttrib1 <> 0
or CatAttrib2 <> 0
or CatAttrib3 <> 0
)
You could create a view, such as (assuming Attribute columns are INT-based, not BIT):
Now you can say: