ok Posted September 3, 2008 Share Posted September 3, 2008 hi guys let say i have a field and this field has many records. but some record have duplicates. now how can i select the uniqe record name only in the field? for example, user_name ----------- john john joey joe gina karen warren karen george warren i want to select them all but not including the duplicate so if i want to select the the name only not including the dupliate then the result is user_name ----------- john joey joe gina karen warren george can you show me the right mysql select command please. Thank you. Link to comment https://forums.phpfreaks.com/topic/122559-i-want-to-select-unique-record-only/ Share on other sites More sharing options...
lemmin Posted September 3, 2008 Share Posted September 3, 2008 I think this should work: "SELECT user_name FROM table GROUP BY user_name" Link to comment https://forums.phpfreaks.com/topic/122559-i-want-to-select-unique-record-only/#findComment-632779 Share on other sites More sharing options...
Fadion Posted September 3, 2008 Share Posted September 3, 2008 SELECT DISTINCT user_name FROM users or SELECT user_name FROM users GROUP BY user_name EDIT: Lemmin beat me to it. Link to comment https://forums.phpfreaks.com/topic/122559-i-want-to-select-unique-record-only/#findComment-632781 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.