heldenbrau Posted November 16, 2010 Share Posted November 16, 2010 I am trying to do the following query, but it produces an error, which I expect. SELECT * FROM newgems WHERE cut='10 Hearts & Arrows' OR cut='8 Hearts & Arrows' WHERE colour='Lavender' OR colour='Light Champagne' OR colour='White' What do I use instead of WHERE? Because if I use AND then it selects everything in White, not just '10 hearts & arrows' and '8 hearts & arrows'. It needs to select only white, lavender or light champagne gemstones that are 8 or 10 hearts and arrows cut. Link to comment https://forums.phpfreaks.com/topic/218848-help-with-query-that-needs-2-wheres/ Share on other sites More sharing options...
ManiacDan Posted November 16, 2010 Share Posted November 16, 2010 Wrap your OR clauses in parens: SELECT * FROM newgems WHERE (cut='10 Hearts & Arrows' OR cut='8 Hearts & Arrows') AND (colour='Lavender' OR colour='Light Champagne' OR colour='White') -Dan Link to comment https://forums.phpfreaks.com/topic/218848-help-with-query-that-needs-2-wheres/#findComment-1134989 Share on other sites More sharing options...
heldenbrau Posted November 16, 2010 Author Share Posted November 16, 2010 Thanks again Link to comment https://forums.phpfreaks.com/topic/218848-help-with-query-that-needs-2-wheres/#findComment-1134996 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.