Home >Database >Mysql Tutorial >How to use in in sql query array
This article mainly shares with you how to use in in sql query array, hoping to help you better use sql statement query.
$platform_ministry = M('platform_ministry')->where(array('platform_id'=>$platform_id))->select(); // 所有科室id // array_column() 函数 从记录集中取出指定的列 array_column(记录集,字段名) $ministry_ids = array_column($platform_ministry,'ministry_id'); $ministry = M("ministry")->where(array('section_id'=>array('in',$ministry_ids),'is_del'=>1))->limit(13)->select(); 表名 -> where(array('字段名' => array('in' , 记录集 ), '字段名' => 值 )) -> 条数 ->select();
You can understand it if you look at it carefully, and you can use it if you change it.
Related recommendations:
MySQL Query Statement Complex Query
MySQL Query Time Basics Tutorial
How to improve sql query efficiency
The above is the detailed content of How to use in in sql query array. For more information, please follow other related articles on the PHP Chinese website!