How to use "find_in_set" in cakephp search method

I have a table in which a comma is bound to the id of another table. I want to use the following query in cakephp in the correct form using find function

"select * from special_offers where find_in_set('".$storeId."', stores) and user_id = '". $userId ."'";
+5
source share
1 answer

Use it as

$data = $this->SpecialOffer->find('all',array('conditions' => array('SpecialOffer.user_id' => $userId ,'FIND_IN_SET(\''. $storeId .'\',SpecialOffer.stores1)')));

Hope this helps you.

+12
source

All Articles