如何使用“find_in_set”在cakephp中查找方法 [英] how to use "find_in_set" in cakephp find method

查看:112
本文介绍了如何使用“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)')));

希望这可以帮助你

这篇关于如何使用“find_in_set”在cakephp中查找方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆