Distinct record selection using mysql

By | February 21, 2014

See the Example

Select * from mydoubts_data

+———+————————-+——————–+
| EMPCODE | NAME | SALARAY CODE |
+———+————————-+——————–+
| 787 | Vasanthan | K |
| GORT | Shaji | S |
| GKL | James | P |
| IND | Abdul | ZO |
| VIS | Sunil | F |
+———+————————-+——————–+

For only Distinct record use the following query.

distinct will show unique record it will not allow duplicate values.

select distinct SALARAY CODE from mydoubts_data;

+——————–+
| SALARAY CODE |
+——————–+
| K |
| S |
| P |
| ZO |
| F |
+——————–+