Remove space from a column in Opencart

Asked

Viewed 43 times

-1

I made a select in the table oc_product SELECT * FROM oc_product in the column sku needed to remove all spaces of these items are over 2000 lines with this problem is possible to remove it dynamically follows a column image with skusinserir a descrição da imagem aqui

1 answer

1


From what I understand Oce needs to leave everything without spaces

Here is an example of an SQL statement to remove these spaces and leave everything together.

SELECT REPLACE(sku, ' ', '' ) FROM oc_product;

Using the command REPLACE thus, all space in this column will be 'removed' in the query

Command to UPDATE:

(Only run this command if you really want to change the data in the database! Otherwise use the previous command)

UPDATE oc_product set sku = REPLACE(sku, ' ', '' )
  • just put this query the way it’s working right ?

  • exact Kirito, in this query it will replace the white spaces in your QUERY, if you really want to change in the bank there will be an UPDATE

  • I added the syntax that would be used in UPDATE

Browser other questions tagged

You are not signed in. Login or sign up in order to post.