Answer the question
In order to leave comments, you need to log in
Display only first name from table field that says "First Name Last Name"?
In the database, the names and surnames of all family members (table FamilyMembers) are stored in the format "first name last name" (field member_name). It is necessary to separate them and display only the names.
I did it like this:
SELECT SUBSTRING(member_name, 1, LOCATE(' ', member_name)) as firstName FROM FamilyMembers
However, for some reason, this is not correct. Help me please
Answer the question
In order to leave comments, you need to log in
Ah, I understand. Remove the space at the end:
SELECT SUBSTRING(member_name, 1, LOCATE(' ', member_name)-1) as firstName FROM FamilyMembers
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question