Magento2 use Multiple LIKE operator in Join Query
-
13-02-2021 - |
سؤال
I have used Join query,in which i'm able to fetch only one row by below query
where $productId = 10
$collection->getSelect()->where('paproduct.product_id = (?)', $productId);
I want to use multiple $productId
in array (May be with LIKE operator).
How can i do it?
$collection->getSelect()->where('paproduct.product_id LIKE ?', $productId);
المحلول
Use IN instead LIKE. For example:
$collection->getSelect()->where('paproduct.product_id IN (?)', $productId);
$productId should be array. Like:
$productId = [1,2];
لا تنتمي إلى magento.stackexchange