Home > Database > Mysql Tutorial > body text

How to use in in sql query array

小云云
Release: 2018-03-09 11:10:55
Original
6274 people have browsed it

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();
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!