Hi,
I have a column empname in a table, the data stored is Lastname,Firstname.
For ex:
empname:
Martin,Ricky
Ford,Henry.
How to do i via select mysql query get the o/p as:
First name Last name
Ricky Martin
Henry Ford
Hi,
I have a column empname in a table, the data stored is Lastname,Firstname.
For ex:
empname:
Martin,Ricky
Ford,Henry.
How to do i via select mysql query get the o/p as:
First name Last name
Ricky Martin
Henry Ford
Try this:
SELECT SUBSTRING_INDEX(empname, ',', -1) AS First_Name,
SUBSTRING_INDEX(empname, ',', 1) AS Last_Name
FROM table
Though I would prefer to do this on the application doing the output.