$Infomation = M("Information"); //新闻表
        $id = $_REQUEST['cid'];   //得到新闻表一级分类的cid
        
        $list = $Infomation->join('INNER JOIN t_category category')
->where("category.parent_id='$id' and category.id=t_information.category_id")
->field('category.name as name,t_information.createTime as time,t_information.title as title,t_information.category_id as id')
->order('t_information.createTime  and category.name   desc')
->select();
        //通过cid 得到 分类表 cid下面的子分类  并且得到信息表 子分类的信息(标题...)注*
  分类表 cid  id 【cid已知】  通过已知cid得到子分类的id    
  信息表 id   fid      fid    通过分类表子分类的id= 信息表的fid 得到子分类的信息
        
        echo $Infomation->getLastSql();
        $this->assign('list', $list);
        //dump($list);
        $this->display('news_list_index');
最终得到以下 结果
name  time  title  id  
行业动态 2012-07-27 00:00:00 为进一步推动创新型企业建设 a2f24b5c3ea7523d8304690931d8b96b 
行业动态 2012-07-12 00:00:00  四是积极组织科技项目申报 a2f24b5c3ea7523d8304690931d8b96b 
行业动态 2012-07-26 00:00:00 三是大力促进成果转化落实。市局(公司 a2f24b5c3ea7523d8304690931d8b96b 
行业动态 2012-07-26 00:00:00 一是不断加大创新成果奖励力度 a2f24b5c3ea7523d8304690931d8b96b 
行业动态 2012-07-31 00:00:00 系统再次掀起群众性创新的热潮 a2f24b5c3ea7523d8304690931d8b96b 
好烟推荐 2012-07-27 00:00:00 国控烟立法工作滞后 6cb75ea42e2f39909135c2c3a7c2b774 
行业动态 2012-07-28 00:00:00 烟草烟草烟草烟草烟草烟草烟草烟草 a2f24b5c3ea7523d8304690931d8b96b 
行业动态 2012-07-27 00:00:00 今后,聊城市高唐县烟草公司局长孙继超将以 a2f24b5c3ea7523d8304690931d8b96b 
这个结果不是想要的  希望子栏目分类下的 子分类分组分开  也就是 好烟推荐和 行业动态 分开

解决方案 »

  1.   

    group貌似不行  最终 我使用的是
            foreach ($t_category as $value) {
                //找到新闻 array(11) 11条新闻
                $chirdren = $Infomation->query("select * from t_information where category_id ='" . $value['id'] . "' order by createTime desc");
                //找到一张带图片的新闻
                $chirdren1 = $Infomation->join('INNER JOIN t_attachment attachment')->where("t_information.id=attachment.id and t_information.category_id='" . $value['id'] . "' and attachment.attPath!=''")->field('t_information.id as pid,attachment.attName as pattName,t_information.title as ptitle,t_information.content as pcontent,t_information.createTime as ptime ')->order('t_information.createTime desc')->find();            $value['chirdren'] = $chirdren; //子类挂在父类id上 array(16)... array(16)  先 父类name    ["chirdren"]  +1 +2      {$vo.name}
                $value = array_merge($value, $chirdren1); //合并数组 得到带图片的新闻            $obj[] = $value; //将父类+子类 编号 放在3维数组里面            $this->assign("t_category", $obj);  //得到一级分类的id
            }