Question: I have 610 products with weights measured in Grams, in a database of over 2000 products.

I can find those products with this search 

```
SELECT * FROM `jos_vm_product` WHERE `product_weight_uom` LIKE 'grams'

```

I would like to change the weight to Kg, which means dividing the product\_weight number by 1000.

I think the division is 

```
SELECT product_weight / 1000 FROM jos_vm_product  

```

Have I missed some apostrophe's there?

How do I join those two queries together?

Answer: 
Try This,

```sql
UPDATE jos_vm_product SET product_weight = product_weight/1000,
product_weight_uom='Kg' WHERE product_weight_uom LIKE 'grams';

```
Based on your use of SELECT only and asking to join those two, I understand you're looking for retrieving the data in a different unit than stored, not actually changing the table.

So, if you meant to change the weight to Kg but only for display purposes, and you did not mean to actually alter the table contents, then you do not need an UPDATE.

In that case, you need a query similar to this:

```
SELECT product_weight / IF(product_weight_uom LIKE 'grams',1000,1)
  FROM jos_vm_product;

```

Your product\_weight will be divided by either 1000 (if the row refers to grams) or 1 (otherwise).