MySQL query to extract first word from a field

后端 未结 4 524
夕颜
夕颜 2021-02-03 19:20

I would like to run a query that returns the first word only from a particular field, this field has multiple words separated by spaces, I assume I may need to carry out some re

4条回答
  •  你的背包
    2021-02-03 20:00

    SUBSTRING_INDEX: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_substring-index

    SELECT SUBSTRING_INDEX(`name`, ' ', 1);
    

提交回复
热议问题