如何从仅包含其中一个部分的字段中选择这些名称

时间:2021-01-20 20:22:20

for example, Name

例如,姓名

ANU
ARUN RAJ
KARTHIK 
TESNA TITUS LESTU

What I want Name

我想要的是什么名字

ANU
KARTHIK

2 个解决方案

#1


1  

Just use not like:

只是使用不喜欢:

select name
from t
where name not like '% %'

#2


0  

Try this to get name column with first name only

试试这个只能获得名字的名字栏

 SELECT Name FROM tableName where LOCATE(" ",TRIM(Name))>1;

#1


1  

Just use not like:

只是使用不喜欢:

select name
from t
where name not like '% %'

#2


0  

Try this to get name column with first name only

试试这个只能获得名字的名字栏

 SELECT Name FROM tableName where LOCATE(" ",TRIM(Name))>1;