# Build a query in Mysql into CakePHP 4

**URL:** <https://discourse.cakephp.org/t/build-a-query-in-mysql-into-cakephp-4/11114>\
**Category:** Need Help\
**Tags:** help\
**Created:** [April 3, 2023, 7:52am UTC](https://discourse.cakephp.org/t/build-a-query-in-mysql-into-cakephp-4/11114 "2023-04-03T07:52:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghaly](https://avatars.discourse-cdn.com/v4/letter/g/b9bd4f/32.png) [@ghaly](https://discourse.cakephp.org/u/ghaly)\
**Post date:** [April 3, 2023, 7:52am UTC](https://discourse.cakephp.org/t/build-a-query-in-mysql-into-cakephp-4/11114/1 "2023-04-03T07:52:05Z")

</div>

My query like :

`SELECT * FROM items WHERE (name LIKE '%lorem%' OR desc LIKE '%lorem%' ) AND status = 1`

which are **name** and **desc** are **translationField**  
I mean in **ItemsI18nTable** table and status column in **Item** table.

so how can I build it in cakephp 4 ?

---

<div class="post-metadata">

**Author:** ![jarekgol](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@jarekgol](https://discourse.cakephp.org/u/jarekgol)\
**Post date:** [April 6, 2023, 10:25pm UTC](https://discourse.cakephp.org/t/build-a-query-in-mysql-into-cakephp-4/11114/2 "2023-04-06T22:25:44Z")

</div>

[https://book.cakephp.org/4/en/orm/query-builder.html#advanced-conditions](https://book.cakephp.org/4/en/orm/query-builder.html#advanced-conditions)  
Read about `OR` at the beginning and try put there 2 `like()` functions described in same chapter.

---

<div class="post-metadata">

**Author:** ![shaan007](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/shaan007/32/2765_2.png) [@shaan007](https://discourse.cakephp.org/u/shaan007)\
**Post date:** [April 7, 2023, 7:37am UTC](https://discourse.cakephp.org/t/build-a-query-in-mysql-into-cakephp-4/11114/3 "2023-04-07T07:37:53Z")

</div>

Hi @ghaly you can try this way :- $this-\>Items-\>find(‘all’,[‘conditions’=\>[‘OR’=\>[‘name LIKE’=\>‘%lorem%’,‘desc LIKE’=\>‘%lorm%’],‘status’=\>1]])

It would be handle many ways bro… for more info you read Cakephp Docs at Once!
