mysql> select DISTINCT title, id from myadmins;
+------+------------+
| id | title |
+------+------------+
| 1 | admin |
| 2 | stack |
| 3 | jeff |
| 4 | admin |
| 5 | stack |
+------+------------+
1 row in set (0.00 sec)
EDIT
What I want is not repeting the title column
+------+------------+
| id | title |
+------+------------+
| 2 | stack |
| 3 | jeff |
| 4 | admin |
+------+------------+
1 row in set (0.00 sec)
DISTINCTapplies to the entire row of data. Since theIDis different on each row, then you will end up with duplicate titles.If you need the
ID, then you could use an aggregate to get theMAX(ID):See SQL Fiddle with Demo