如何将SQL查询转换为CakePHP查询

时间:2014-07-08 05:22:33

标签: cakephp

我有以下查询,其中interest是字段名称。 interest包含足球,排球等。

SELECT * FROM `drop_down_multiples` where find_in_set('football',`interest`);

我坚持在CakePHP转换上述查询。我怎么能转换?

感谢。

1 个答案:

答案 0 :(得分:1)

有些事情是这样的: -

cakephp对此没有任何功能,你必须做一些像cakephp建立的技巧 从他们的语法中查询SQL。

$this->DropDownMultiples->find('all',array(
  'conditions'=>array('FIND_IN_SET("'.$search_field.'",DropDownMultiple.interest)‌​')
  ));