Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

MySQL - split column contents into 2 seperate columns

Avatar of sabecs
sabecs asked on
MySQL Server
2 Comments1 Solution169 ViewsLast Modified:
Is there a way to spilt `contact` column from my users table below into `First_Name` & `Last_Name`?

Basically want to find the first space in `contact` column and split first section into   `First_Name`  and remaining into `Last_Name` ?

CREATE TABLE IF NOT EXISTS `users2` (
  `id` int(6) NOT NULL AUTO_INCREMENT,
  `email` varchar(90) DEFAULT NULL,
  `contact` varchar(40) DEFAULT NULL,
  `First_Name` varchar(120) DEFAULT NULL,
  `Last_Name` varchar(120) DEFAULT NULL,
  `Phone` varchar(30) DEFAULT NULL,
  `comments` text,
  `Business_Name` varchar(150) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 PACK_KEYS=0 AUTO_INCREMENT=1890 ;

--
-- Dumping data for table `users2`
--

INSERT INTO `users2` (`id`, `email`, `contact`, `First_Name`, `Last_Name`, `Phone`, `comments`, `Business_Name`) VALUES
(58, 'email2@gmail.com.au', 'Peter Testing', NULL, NULL, NULL, NULL, NULL),
(57, 'email4@gmail.com.au', 'Kathy Tristan', NULL, NULL, NULL, NULL, NULL),
(18, 'email5@gmail.com.au', 'Christoper Roberts', NULL, NULL, NULL, NULL, NULL);