SQL SELECT WHERE IN
Here is a basic sql statement where you are looking for shirts that are red, white or blue.
SELECT * FROM `shirts` WHERE `color`='red' OR `color`='white' OR `color`='blue'
Here is the same request, more efficiently constructed using IN
SELECT * FROM `shirts` WHERE `color` IN ('red','white','blue')
If you are like me and dynamically create SQL statements using PHP then you get the idea of how easy it would be to create this statement. Let's say you have an array of possible value.
























Thanks a lot, it saved me other hours of searching
it helped me a lot in the project I work on.