4,250
社区成员
发帖
与我相关
我的任务
分享
'clo' => 'count(Cloth.clothname)',
'clo2' => 'sum(Cloth.inprice)'
var $paginate = array(
'Cloth' => array(
'limit' => 5,
'conditions' => array(),
'fields' => array('clo','clo2','Cloth.clothid','Cloth.clothname','Cloth.indate','Cloth.inprice','Cloth.sellprice'),
'group' => array('Cloth.clothname'),
//'page'=>1
)
);
<?php echo $paginator->prev('<< '.__('戻', true), array(), null, array('class'=>'disabled'));?>
| <?php echo $paginator->numbers();?>
<?php echo $paginator->next(__('次', true).' >>', array(), null, array('class'=>'disabled'));?>
var $paginate = array(
'Cloth' => array(
'limit' => 5,
'conditions' => array(),
//'fields' => array('Cloth.clothid','Cloth.clothname','Cloth.indate','Cloth.inprice','Cloth.sellprice'),
'fields' => array('clo','clo2','Cloth.clothid','Cloth.clothname','Cloth.indate','Cloth.inprice','Cloth.sellprice'),
'group' => array('Cloth.clothname'),
'page'=>1
)
SELECT clothid , clothname , inprice ,indate ,sellprice , count( clothname ) as clothnums, sum( inprice ) as pricesums FROM cloths GROUP BY clothname
SELECT `Cloth`.`id`, `Cloth`.`clothid`, `Cloth`.`clothname`, `Cloth`.`clothexpl`, `Cloth`.`clothremark`, `Cloth`.`inprice`, `Cloth`.`indate`, `Cloth`.`sellprice`, `Cloth`.`created`, `Cloth`.`modified`, (count(`Cloth`.`clothname`)) AS `Cloth__clo`, (sum(`Cloth`.`inprice`)) AS `Cloth__clo2` FROM `cloths` AS `Cloth` WHERE 1 = 1 ORDER BY `Cloth`.`clothname` asc LIMIT 20
'fields' => array('clo','clo2','Cloth.clothid','Cloth.clothname','Cloth.indate','Cloth.inprice','Cloth.sellprice'),
'group' => array('Cloth.clothname'),