radit91 Posted March 23, 2012 Share Posted March 23, 2012 SELECT SUBSTRING ( Name, CHARINDEX ( ' ', Name ) + 1, LEN ( Name ) ) + ', ' + SUBSTRING ( Name, 1, CHARINDEX ( ' ', Name ) ) as 'Name' Hai guys. The code is about putting the last name to the front, the last name to the back, and put coma(,) in the middle. But, the code was to complicated for me. Can you please explaine it to me or maybe give other code that is much simpler and if you could with some explanation. I'm new to the SQL. Thankyou. Link to comment Share on other sites More sharing options...
justsomeguy Posted March 28, 2012 Share Posted March 28, 2012 Depending on which database you're using, check the reference for the string functions for that database to see what each of those functions (substring, charindex, len, etc) does. This is the string function reference for MySQL, for example: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.