yii - using CActiveDataProvider to display group by MYSQL record -
please need quick right now. here question
i have table several columns. using yii framework display data want group record in way
column 1 column2 column3 column4
1 2 3 4
80 3 1 100
30 3 1 60
50 3 0 10
90 2 3 40
100 2 1 80
so want query table display column2 , column3, group column2. having issues that, column2 returns 2,2 - 3,3 , group record column3 under each of duplicated column2
my result should display in way:
........................................................................ column2 -- 2 .1 .3 ......................................................................... column2 -- 3 .0 .1
controller::
protected function displaybycategory() { //$model = new mymodel; $criteria= new cdbcriteria(); $criteria->distinct = true; $criteria->group = 'column2,column3'; $criteria->order = 'column2'; //$dataprovider=new cactivedataprovider('mymodel' ); $dataprovider=new cactivedataprovider('mymodel', array( 'criteria'=>$criteria, 'pagination'=>false, )); $this->renderpartial('application.views.competency.ctype',array( 'dataprovider'=>$dataprovider, )); }
my view:
<ul id="example1" class="accordion"> <li> <h3><?php echo chtml::link(chtml::encode($data->column2)); ?></h3> <div class="panel loading"> <h4><?php echo chtml::link(chtml::encode($data->column3)); ?></h4> </div> </li> </ul>
please need quick right now. here question i have table several columns. using yii framework display data want group record in way column 1 column2 column3 column4 1 2 3 4 80 3 1 100 30 3 1 60 50 3 0 10 90 2 3 40 100 2 1 80 so want query table display column2 , column3, group column2. having issues that, column2 returns 2,2 - 3,3 , group record column3 under each of duplicated column2 my result should display in way: ........................................................................ column2 -- 2 .1 .3 ......................................................................... column2 -- 3 .0 .1 controller:: my view: | |||
|