Select multiple records by one query
- by kofto4ka
Hello there. Please, give me advice, how to construct select query. I have table table with fields type and obj_id. I want to select all records in concordance with next array:
$arr = array(
0 => array('type' => 1, 'obj_id' => 5),
1 => array('type' => 3, 'obj_id' => 15),
2 => array('type' => 4, 'obj_id' => 14),
3 => array('type' => 12, 'obj_id' => 17),
);
I want to select needed rows by one query, is it real? Smth like
select * from `table` where type in (1,3,4,12) and obj_id in (5,15,14,17)
But this query returns also records with type = 3 and obj_id = 14, and for example type = 1 and obj_id = 17.
p.s. moderators, please fix my title, I dont know how to describe my question.