Remove space from a column in Opencart

-1

I made a select in the table oc_product SELECT * FROM oc_product in the column sku needed to remove all the spaces of these items are more than 2000 lines with this problem it is possible to remove this dynamically follows an image of the column with skus

    
asked by anonymous 26.10.2018 / 17:33

1 answer

1

So I understand you need to leave everything without spaces

Here is an example SQL statement to remove these spaces and leave it all together.

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

Using the REPLACE command in this way, all of the space in that column will be 'removed' in the query

Command for UPDATE :

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

UPDATE oc_product set sku = REPLACE(sku, ' ', '' )
    
26.10.2018 / 18:17