如何使用“find_in_set”在cakephp中查找方法
问题描述:
我有一个表,其中逗号分隔的另一个表的id我想在cakephp中以正确的形式使用find函数使用以下查询
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 ."'";
答
使用方法
$data = $this->SpecialOffer->find('all',array('conditions' => array('SpecialOffer.user_id' => $userId ,'FIND_IN_SET(\''. $storeId .'\',SpecialOffer.stores1)')));
希望这可以帮助你