我尝试过滤我的集合,其中包含“或”和“过滤器” 其中t_id& t_code都是属性
$collection->addAttributeToFilter(
array(
array(
'attribute' => 't_id',
'null' => true
),
array(
'attribute' => 't_id',
'finset' => $allowedtId
)
)
);
$collection->addAttributeToFilter(
array(
array(
'attribute' => 't_code',
'null' => true
),
array(
'attribute' => 't_code',
'finset' => $tAttCode
)
)
);
这是查询的SQL
WHERE ((at_t_id.value IS NULL) OR (FIND_IN_SET('', at_t_id.value))) AND ((at_t_code.value IS NULL) OR (FIND_IN_SET('2348', at_t_code.value)))
但我想尝试这样的事情
WHERE (at_t_id.value IS NULL)
OR
(
(FIND_IN_SET('1245', at_t_id.value))
AND
(
(at_t_code.value IS NULL)
OR
(FIND_IN_SET('2348', at_t_code.value))
)
)
有什么办法可以实现吗?