如何将SQL查询转换为CakePHP查询 [英] How to convert SQL query to CakePHP query
本文介绍了如何将SQL查询转换为CakePHP查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下查询其中 interest
是字段名称。 interest
包含足球,vollyball等。
I have following query where interest
is field name. interest
contains like football,vollyball etc.
SELECT * FROM `drop_down_multiples` where find_in_set('football',`interest`);
我在 CakePHP
。如何转换?
感谢。
推荐答案
这个: -
cakephp没有任何函数,你必须做一些技巧cakephp如何从他们的语法构建
sql查询。 p>
cakephp haven't any function for this,you have to do some tricks that how cakephp built the sql queries from their syntax.
$this->DropDownMultiples->find('all',array(
'conditions'=>array('FIND_IN_SET("'.$search_field.'",DropDownMultiple.interest)')
));
这篇关于如何将SQL查询转换为CakePHP查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文