Home  >  Article  >  Backend Development  >  How to write compound sql in php's medoo?

How to write compound sql in php's medoo?

WBOY
WBOYOriginal
2016-08-18 09:16:191146browse

<code>select * from `items` where `id` in (select `uid` where `is_test`=1)
</code>

I want to check data like this, how can I write it like this in medoo?

Reply content:

<code>select * from `items` where `id` in (select `uid` where `is_test`=1)
</code>

I want to check data like this, how can I write it like this in medoo?

<code class="php">$database->query('select * from `items` where `id` in (select `uid` where `is_test`=1)')->fetchAll();</code>

$db->select('items', '*', ['id'=>$db->select('table', 'uid', ['is_test'=>1])]) ;

The statement in your in above should be missing table? It’s almost like this, you can change it accordingly. It's best to read the official documentation, it's all there. Some of the Chinese version documents are older and have not been updated.

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
Previous article:PDO query result errorNext article:PDO query result error