E
E
eavy2020-06-25 15:50:34
MySQL
eavy, 2020-06-25 15:50:34

Mysql how to remove all text from a column after a space?

Hello.
There is a column in which names and surnames are indicated.

5ef49d0fc3a7b921407684.jpeg

Please tell me a query with which you can delete all text after a space, i.e. get rid of the names.

I have no knowledge at all.
I was looking for manuals, but there are some complex tasks, but I don’t know how to implement such a simple one.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
eavy, 2020-06-25
@eavy

solution
UPDATE `my_table`
SET `name` = SUBSTRING_INDEX(`name` , ' ', 1),

S
Stalker_RED, 2020-06-25
@Stalker_RED

UPDATE `my_table`
SET `name` = REGEXP_REPLACE(`name`, '\s.+', '')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question