Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use "find_in_set" in cakephp find method

Tags:

cakephp

I have a table in which comma seprated id of another table i want to use the following query in cakephp in proper form with find function

"select * from special_offers where find_in_set('".$storeId."', stores) and user_id = '". $userId ."'";
like image 829
Deepak Goyal Avatar asked Mar 03 '12 09:03

Deepak Goyal


1 Answers

Use like this

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

Hope this may help you

like image 133
Shivomkara Chaturvedi Avatar answered Sep 21 '22 00:09

Shivomkara Chaturvedi