关于查询 where 中or的问题,可以使用下列表达式的写法:
$where = [
'post.post_status' => [ 'eq' , 1 ] ,
'post.relation_id' => [ [ 'eq' , $relation_id] , [ 'eq' , 0 ] , [ 'EXP' , 'IS NULL' ] , 'or' ] ,
];
输出的结果为:
WHERE post.post_status=1 AND (post.relation_id=$relation_id OR post.relation_id=0 OR post.relation_id is null);
网友评论