show query result

hello, i’m a new member, i wonder if there is someone who can help me please

i have two tables user(iduser,loginu, pass) and resultsglobal(iduser,date) , i want to execute this query and show the results in CGridview

login | cr

jean 34222

christine 42343132

how can i show the result returned by a select query in my CGridview??



in your controller:

$sql='select u.loginu as login , count(*) as cr


resultsglobal as r , user as u


r.iduser = u.iduser

group by u.loginu’;

$dataProvider=new CSqlDataProvider($sql, array());

$this->render(‘view’, array(‘dataProvider’=>$dataProvider));

in your view:

$this->widget(‘zii.widgets.grid.CGridView’, array(



i dont have try this lines… but i think u understand what i want to say :)

thank you,

i’ve resolved it using $criteria