How to split the name string in mysql?

后端 未结 16 2182
轮回少年
轮回少年 2020-11-22 11:44

How to split the name string in mysql ?

E.g.:

name
-----
Sachin ramesh tendulkar
Rahul dravid

Split the name like firstname

16条回答
  •  悲&欢浪女
    2020-11-22 12:11

    select (case when locate('(', LocationName) = 0 
            then 
                horse_name
            else 
               left(LocationName, locate('(', LocationName) - 1)
           end) as Country            
    from   tblcountry;
    

提交回复
热议问题