string str2 = "select pm.paxseqno,pm.guestallowed,pm.paxname,pm.cardtype,pm.class,pm.paxseatno,pm.status,pm.ffpno,pm.Time,CASE WHEN cf.Cabin = 'F' THEN'First Class'WHEN cf.Cabin = 'E' THEN 'Economy' WHEN cf.Cabin = 'P' THEN 'Premiere'WHEN cf.Cabin = 'K' THEN 'Unknown'ELSE 'Unknown' END as Cabin from paxmaster Pm left join cabininfo cf on Pm.class=cf.class
pm.paxname contails Full Name Like 'DALAL MIHIRMR' this
and i want to split name in to two column Like First Name is' MIHIRMR' and Second Clolumn is 'DALAL' in My Sql
So How to do this
Please Help


Faisal PathanRank #291 · 8.6K reputationPosted Nov 14, 2018, 7:54 PM EST
select left(name, CHARINDEX(' ', name)) as firstname, substring(name, CHARINDEX(' ', name)+1, len(name)-(CHARINDEX(' ', name)-1)) as lastname from users If it helps mark as accepted answer so other user can refer.MukeshRank #7,688 · 236 reputationPosted Nov 14, 2018, 8:36 PM EST
Faisal PathanRank #291 · 8.6K reputationPosted Nov 14, 2018, 9:19 PM EST
SUBSTRING_INDEX(POS, ',', 1)for position1SUBSTRING_INDEX(POS, ',', -1)for position2MukeshRank #7,688 · 236 reputationPosted Nov 14, 2018, 9:21 PM EST
Faisal PathanRank #291 · 8.6K reputationPosted Nov 14, 2018, 10:42 PM EST
Jignesh KumarRank #91 · 22.9K reputationPosted Nov 15, 2018, 4:32 AM EST