SELECT REPLACE and save the replacement changes MySQL

Viewed 175

I am trying to replace all '-' in my column but I don't know how to combined SET and REPLACE. Please respond with what my SQL query should look like.

MYSQL SCREENSHOT

1 Answers

You may need to use the UPDATE statement:

UPDATE ldr.client_order
SET waybill = REPLACE(waybill, '-', '')
WHERE INSTR(waybill, '-') > 0

The WHERE clause you can use to update only those entries had the -. If you are avoid the WHERE clause it will update for all the entries.

Related