# How to use OR in matching query?

**URL:** <https://discourse.cakephp.org/t/how-to-use-or-in-matching-query/976>\
**Category:** Need Help\
**Created:** [August 14, 2016, 4:47pm UTC](https://discourse.cakephp.org/t/how-to-use-or-in-matching-query/976 "2016-08-14T16:47:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mehdifathi](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/mehdifathi/32/241_2.png) [@mehdifathi](https://discourse.cakephp.org/u/mehdifathi)\
**Post date:** [August 14, 2016, 4:47pm UTC](https://discourse.cakephp.org/t/how-to-use-or-in-matching-query/976/1 "2016-08-14T16:47:45Z")

</div>

Hello. i have 3 tables.i want to use some matching OR in my query.but i can’t.i can matchin with and but i don’t know how to use or in matching query.this is my code.

```
$Find_contests->matching('Designs', function ($q)use ($Id_user)
{
   return $q->Where(['Designs.user_id' => $Id_user]);

}
);
$Find_contests->matching('Invitationscontests', function ($q)use ($Id_user)
{
   return $q->Where(['Invitationscontests.designer_id' => $Id_user]); }
);

```

it can find by and but i wana find ‘Invitationscontests.designer\_id’ =\> $Id\_user or Designs.user\_id’ =\> $Id\_user.help me please

---

<div class="post-metadata">

**Author:** ![rrd](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/rrd/32/113_2.png) [@rrd](https://discourse.cakephp.org/u/rrd)\
**Post date:** [November 21, 2017, 7:43pm UTC](https://discourse.cakephp.org/t/how-to-use-or-in-matching-query/976/2 "2017-11-21T19:43:27Z")

</div>

Did you find a solution?
