Display Unique Records

Hi All,

   I have a table as Student(st_id,st_name,st_number). In this table it is possible that each student can have multiple records. Now I want to display only those records which are distinct by st_name in CGridview.

Sample Data can be :

1—abc—123

2—xyz—456

3—abc—852

4—abc—956

5—xyz—417

Sample Query can be :

"select distinct(st_name) from student;"

How to set distinct value only on "st_name" column?

Thanks!!! ::)

Hi,

I think u can use unique keyword in criteria

Thanks for Response!!!

Can you please give example for that??

Hi,

Here goes for you an example

Here goes another one

http://www.bsourcecode.com/2013/06/cdbcriteria-in-yii/