database - Zend query sort by multiplication of columns -


i trying query rows mysql database zend framework 1. need columns, want sort them multiplication of columns:

$select = $this             ->select()             ->where('start_date < ' . $currenttime)             ->where('end_date >' . $currenttime)             ->order('columna * columnb desc'); 

this isn't working.

with zend documentation, i'm getting this:

$select = $this->select()          ->from(array('p' => 'products'),                 array('product_id',                       'order_column' =>                           new zend_db_expr('columna * columnb'))                 )          ->order('order_column desc); 

however, returns product_id , new order_column, need columns.

how there? how return columns of selected rows, ordered columna * columnb?

too quick. found solution trying:

$select = $this     ->select()     ->where('start_date < ' . $currenttime)     ->where('end_date >' . $currenttime)     ->order(new zend_db_expr('columna * columnb desc')); 

this gives desired result.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -