jeudi 29 janvier 2015

SQL weight multiplication


Hi all i have two columns :



+--------------------+----------------+
| Units/Pk | PackWeight/Vol |
+--------------------+----------------+
| 1.0000000000000000 | 150g |
+--------------------+----------------+
| 1.0000000000000000 | 150g |
+--------------------+----------------+
| 1.0000000000000000 | 114g |
+--------------------+----------------+
| 1.0000000000000000 | 500g |
+--------------------+----------------+
| 1.0000000000000000 | 200g |
+--------------------+----------------+
| 1.0000000000000000 | 500g |
+--------------------+----------------+
| 1.0000000000000000 | 500g |
+--------------------+----------------+
| 1.0000000000000000 | 200g |
+--------------------+----------------+
| 1.0000000000000000 | 200g |
+--------------------+----------------+
| 4.0000000000000000 | 100g |
+--------------------+----------------+
| 4.0000000000000000 | 125g |
+--------------------+----------------+
| 4.0000000000000000 | 125g |
+--------------------+----------------+
| 1.0000000000000000 | 500g |
+--------------------+----------------+


I need to multiply these together for result to replace values in PackWeight/Vol i.e. Units/Pk * PackWeight/Vol AS PackWeight/Vol. How do i do this? i.e. where units is 4 result would be 400g, 500g, 500g respectfully. Other results would stay the same as units are 1. Units/Pk is numeric and packweight is nvarchar. Thanks!





Aucun commentaire:

Enregistrer un commentaire