AZEL wrote:
>
> $select->where('b.status = ?', 'new')
>       ->order('b.status ASC');
> and $select->order("b.status = 'new'");
> has 2 differnt results.
>
> $select->order("b.status = 'new'");
> sort by status where is equal to 'new' at first.

What you want is:

  $select->order( new Zend_Db_Expr("b.status = 'new'") );

By default, the order() method tries to delimit the identifier you name, to allow you to use identifiers with special characters more easily.

If you need to use an expression in your sorting, you need to create a Zend_Db_Expr object to signify that no delimiting should be done.

Regards,
Bill Karwin

Reply via email to