i need to select only the first name (that is the first word) of the user.
For example, Andy Jones, only select Andy
Any idea?
thanks
Take a look at substring_index.
select substring_index(field, " ", 1) ....
If I understand, your FirstName and LastName are in one column. You can achieve this using user defined functions.
Example:
SELECT SPLIT_STR(name, ' ', 1) as firstname FROM users;
Read following post for more options:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With