title: sql server: select either conditions using an OR clause?
body: <p>I have a Products tablet; in that there are a couple of fields like subcatid and designerid, which are coming from a Subcategories and Designers tables respectively. The website (ASP.NET C#) admin can insert some kind of Coupon Codes in a CouponCodes table by selecting either a designerid or a subcatid or both. This means that a particular product can be sold cheaper if either designerid or the subcatid fields or both for that product is found inside the CouponCodes table. Note, a Product does not necessarily have a designerid or a subcatid: An Admin can enter 'N/A' for either as Product is entered; the N/A has designerid of 27 and a subcatid of 9 in their respective tables. Probably not the best database design.</p>
  
  <p>Anyway, here is my code in SSMS; when I try execute it I get an error of syntax. How to implement the sql? Thanks!</p>
  
  <pre><code>select * from couponcodes 
  where ( couponcodes.subcatid in 
  (select subcatid from Products where Products.prodid = 1012)
  AND (couponcodes.couponcode = '5braceLets'))
  
  OR 
  
  Where  ( couponcodes.designerid in 
  (select designerid from Products where Products.prodid = 1012)
  AND (couponcodes.couponcode = '5dora'))
  </code></pre>