Skip to content
Advertisement

Insert additional text into table fields

I export a CSV-File with shipping weights from my webshop. The problem is there are bulk numbers and no unit Like this:

+------+------+
| ID   |weight|
+------+------+
| 101  | 1,2  |
+------+------+
| 102  | 2,5  |
+------+------+

But I need a result like this:

+------+------+
| ID   |weight|
+------+------+
| 101  |1,2 kg|
+------+------+
| 102  |2,5 kg|
+------+------+

This is the statement:

SELECT id_product AS `ID`, weight AS `weight` FROM products

Is it possible to add a string (‘kg’) into the SELECT statement or something of a kind? Or are there other possible solutions? (The system works with SELECT only)

Advertisement

Answer

Please try the below query.

SELECT id_product AS `ID`, CONCAT(weight ,' kg') AS `weight` FROM products

Hope will help you

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement