Menu

Monday, 30 December 2013

Retrieve Unique Value from Table Column with Using DISTINCT & GROUP BY Keyword


Emp_id
Emp_name
Emp_mob
1
Suryagroops
9532771738
2
Suresh
9452358456
3
Mayank dixit
9896564556
4
Suryagroops
9878522132
5
Ramesh
8004677781
6
Ramesh
8785455852
                                                                                               
                                                   Figure: suryagroops_0003 (tbl_emp)

DISTINCT

Select DISTINCT Emp_name from tbl_emp;

GROUP BY
 
Select Emp_name from tbl_emp GROUP BY Emp_name;

Result-

Emp_name
Suryagroops
Suresh
Mayank dixit
Ramesh

No comments: