在cakephp中按字段排序 [英] Order by field in cakephp
本文介绍了在cakephp中按字段排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在用cakephp做项目。
I am doing project in cakephp .
我想在以下查询中编写cakephp样式。我写了50%。请帮助我
I want to write below query in cakephp Style. I've written 50% . Please help me
$ this->登录->查找('全部')
$this->Login->find('all')
SELECT * FROM login
ORDER BY FIELD(profile_type, 'Basic', 'Premium') DESC;
推荐答案
请尝试一下
$this->Login->find('all', array(
'order'=>array('FIELD(Login.profile_type, "basic", "premium") DESC')
));
这篇关于在cakephp中按字段排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文