我创建了一个查询,允许我根据订购的数量对我的产品进行排序。但是当我打印查询时,订购的数量是按升序排列的。我想让它按降序工作。查询如下
$toDate = date("Y-m-d h:m:s", strtotime('tomorrow') - 1);
$fromDate = date("Y-m-d h:m:s", strtotime("-1 months"));
$this->getSelect()->joinLeft(array('sfoi' => $this
->getTable('sales/order_item')),
"e.entity_id = sfoi.product_id AND sfoi.created_at BETWEEN
'{$fromDate}' AND '{$toDate}'",
array('qty_ordered' => 'SUM(sfoi.qty_ordered)'))
->group('e.entity_id')
->order("qty_ordered {$dir}");
return $this;
谁能让我知道如何做到这一点?我只想将“ qty_ordered ”的顺序从 ASC 更改为 DESC