mrherman Posted August 22, 2010 Share Posted August 22, 2010 Hi In a SELECT statement, I need to fetch a last name from a field up to but not including the comma, if there is one in the field. The field I need to select from is 13 chars wide, and is in the following format: Johnson, John Smith, Suzy Valadovichici Marks, Markie So, some last names take up the entire 13-char field. What I need from the above is: Johnson Smith Valadovichici Marks Thanks for any help. Link to comment https://forums.phpfreaks.com/topic/211404-select-chars-in-a-name-field-but-stop-at-comma/ Share on other sites More sharing options...
fenway Posted August 22, 2010 Share Posted August 22, 2010 SUBSTRING_INDEX() is your friend. Link to comment https://forums.phpfreaks.com/topic/211404-select-chars-in-a-name-field-but-stop-at-comma/#findComment-1102265 Share on other sites More sharing options...
mrherman Posted August 22, 2010 Author Share Posted August 22, 2010 Wow...Made to order! Thank you very much! Link to comment https://forums.phpfreaks.com/topic/211404-select-chars-in-a-name-field-but-stop-at-comma/#findComment-1102401 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.