When I use
SELECT * FROM table WHERE column IN (1, 2, 3, 3, ..., 1000)
It is taken to be
... WHERE column = 1 OR column = 2 OR ... OR column = 1000
But I would like this
... WHERE column = 1 AND column = 2 AND ... AND column = 1000
in column there are id parameters. Is there an easy way to solve this?
It is possible, bacause it is table with m:n relationship. One product can have many paramameters.
CREATE TABLE IF NOT EXISTS `productparametervalues` (
`f_product_id` int(11) NOT NULL AUTO_INCREMENT,
`f_parameterValue_id` int(11) NOT NULL,
PRIMARY KEY (`f_product_id`,`f_parameterValue_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=11 ;
EDIT: Modified my answer to match the table schema that was added to the question.
You can use a GROUP BY/COUNT DISTINCT to achieve this. The value tested on the HAVING COUNT should be equal to the number of items that are included in the IN clause.