I have the following problem.
My table, say tab1, has name column as follows "LastName, FirstName". I want to make it so that the column becomes "FirstName LastName".
Any ideas on how this is to be done? Note that there is no comma present, but i guess that can be easily removed once I figure out how to actually flip the first and the last names.
Any help would be appreciated.
replace @NAME with your real value:
SELECT TRIM(SUBSTR(@NAME, LOCATE(",", @NAME) + 1)) AS prename, TRIM(SUBSTR(@NAME, 1, LOCATE(",", @NAME) - 1)) AS surename
This will extract the prename and surename part, now you can insert/modify the data as you want to.