Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql Zend框架按最后升序空值排序_Mysql_Zend Framework - Fatal编程技术网

Mysql Zend框架按最后升序空值排序

Mysql Zend框架按最后升序空值排序,mysql,zend-framework,Mysql,Zend Framework,我想我的订单条款我想做一些类似的事情 select MyDate from MyTable order by case when MyDate is null then 1 else 0 end, MyDate 我怎么写 order by case when MyDate is null then 1 else 0 end, MyDate 在泽德 我已经试过了 ->order('by case when MyDate is null then 1 else 0 end', 'MyDat

我想我的订单条款我想做一些类似的事情

select MyDate
from MyTable
order by case when MyDate is null then 1 else 0 end, MyDate
我怎么写

order by case when MyDate is null then 1 else 0 end, MyDate
在泽德 我已经试过了

->order('by case when MyDate is null then 1 else 0 end', 'MyDate')

建议?

最好向我们提供错误消息或
echo$select
,以便我们了解问题所在

试试这个:

->order(new Zend_Db_Expr('case when MyDate is null then 1 else 0 end, MyDate'));

传递
Zend\u Db\u Expr
对象总是将其按原样放入查询中,无需任何修改。

根据我在本文中找到的内容,这可能适用于您:

->order(new Zend_Db_Expr("-MyDate DESC"));