Home  >  Article  >  Database  >  How to use in in sql query array

How to use in in sql query array

小云云
小云云Original
2018-03-09 11:10:556193browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn