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);

1 Answer 1


Use IN instead LIKE. For example:

$collection->getSelect()->where('paproduct.product_id IN (?)', $productId);

$productId should be array. Like:

$productId = [1,2];
  • It's so simple, why I dont know this? Commented Jan 9, 2019 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.