$aAwardMem = $this->dao_raward->getAwardAndMem($where,array('award_cat asc','award_level asc'),false,false,false,'award_cat,award_level,count(id) as count',false,array('award_cat','award_level'));
//$where = false, $order = 'id ASC', $pagesize = false, $offset = false, $count = false, $from = false, $join = false, $group = false
这里先按照award_cat排序,再按照award_level排序。
完了之后,对award_cat进行group操作,cat是类别,和award_level进行group操作。
这样就将cat,level剥离出来了。
成了一小组,一小组的数据,并且是有序的数据。
最后获取自己想要的字段award_cat,award_level,以及他们的各小组的数量。count(id)。
能够灵活的运用好他们,可以省去很多php的逻辑处理。
数据如下:
Array
(
[] => Array
(
[award_cat] =>
[award_level] =>
[count] =>
) [] => Array
(
[award_cat] =>
[award_level] =>
[count] =>
) [] => Array
(
[award_cat] =>
[award_level] =>
[count] =>
) [] => Array
(
[award_cat] =>
[award_level] =>
[count] =>
) [] => Array
(
[award_cat] =>
[award_level] =>
[count] =>
) [] => Array
(
[award_cat] =>
[award_level] =>
[count] =>
) [] => Array
(
[award_cat] =>
[award_level] =>
[count] =>
) [] => Array
(
[award_cat] =>
[award_level] =>
[count] =>
) [] => Array
(
[award_cat] =>
[award_level] =>
[count] =>
) [] => Array
(
[award_cat] =>
[award_level] =>
[count] =>
) [] => Array
(
[award_cat] =>
[award_level] =>
[count] =>
) [] => Array
(
[award_cat] =>
[award_level] =>
[count] =>
) )