grammar:
WHERE column IN (value1,value2,...) WHERE column NOT IN (value1,value2,...)
1. After in is a recordset, such as:
select * from table where uname in(select uname from user);
example:
SELECT * FROM article WHERE uid IN(SELECT uid FROM user WHERE status=0)
In this SQL example, we implement to find all articles of all users whose status is 0 (possibly banned). First get all users with status=0 through a query:
2. In is followed by a string, such as:
select * from table where uname in('aaa',bbb','ccc','ddd','eee',ffff'');
Note: The string must be marked with single quotes '' here;
3. After in is an array, use the following methods, please refer to:
$list is ' 1 , 2 , 3 , 4 , 5 '
foreach (explode(',', $list) as $value) { $rules=$rules."'".$value."',"; } $arr = $this->db->selectAll('slim_auth_rule'," id IN (".$rules."'')",'id,title');