我试图在CakePHP 3.6中获取一些数据。条件是基于同一个表中的2列。第一列是status
,第二列是is_done_by_user
。所以我想在状态是1
或2
时获取数据。同样,如果状态是3
。但对于状态3,需要检查列is_done_by_user
是否具有值1
。因此,最后一件事是。我希望获得具有status
、1
和2
的所有数据。所有状态为3
的数据,其中is_done_by_user
是1
。我已经编写了查询,但它没有按照我想要的方式工作。以下是我到目前为止尝试的查询。
$query = $this->find('all',[
'conditions' => [
'Appointments.is_active' => 1,
'Appointments.status IN' => (1,2,3),
'Appointments.is_done_by_user' => 1
]
]);
也许我离实际的查询很远。
1条答案
按热度按时间fdx2calv1#
您的查询将找到所有陈述的条件都为真的任何内容,这显然不是您想要的。我认为这可能是您要寻找的内容?