I
I
igor13112020-05-30 16:06:37
MySQL
igor1311, 2020-05-30 16:06:37

How to replace the first digit of a number in MySQL?

Hello. Can you please tell me what query can be used to replace the first digit 8 with 7 in the column with phone numbers in the MySQL database. table users column phone

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
galaxy, 2020-05-30
@galaxy

UPDATE users
   SET phone = CONCAT('7', SUBSTR(phone, 2))
 WHERE LEFT(phone, 1) = '8';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question