質問

I want to add something like WHERE (table1.attrib1 IN (1,2,3) OR table2.attrib2 IN (1,2,3)) to a product collection to which I have already joined a couple of tables.

I tried this, but it doesn't work because it took '1,2,3' as one string (that is, did not put them in brackets after IN). How can I use WHERE?

$productCollection->getSelect()->join(array('table1' => $table1), 'e.entity_id = table1.entity_id', array('my_attribute1' => 'table1.value'))->join(array('table2' => $table2), 'e.entity_id = table2.entity_id', array('my_attribute2' => 'table2.value'))->where('table1.attrib1 IN ? OR table2.attrib2 IN ? ', '1,2,3')

正しい解決策はありません

ライセンス: CC-BY-SA帰属
所属していません magento.stackexchange
scroll top