Disclaimer: never ever ever directly edit the database.
Ever.
Instead, write a script that bootstraps Magento and iterates through, updating the values via Magento ORM. This makes the change available to all areas of the application that might need to know about that SKU update:
<?php
require('app/Mage.php');
Mage::app();
$products = Mage::getModel('catalog/product')->getCollection();
foreach($products as $product){
$newsku = $product->getSku() . '_1';
$product->setSku($newsku);
$product->save();
}
In this contrived example all SKUs will be updated to have a _1 appended to them. There are some caveats here:
- This is going to take forever if you have more than, like, 10 products.
- This is going to be deadlock prone - don't run on a production store.
- Unless you disable
index on save it will pretty much run until Magento 2 is released.
I'm feeling dangerous:
It is very easy to update all skus - it is not clear, however, from your question what values you're trying to cobble together to make a new SKU. So here are a few options of how to do this:
Append a value:
UPDATE catalog_product_entity SET sku = CONCATENATE(sku, '_1');
Append a value as a result of a subquery:
UPDATE catalog_product_entity cpe SET cpe.sku = CONCATENATE(cpe.sku,
(
SELECT type_id FROM catalog_product_flat_1 cpf1 WHERE cpf1.sku=cpe.sku
)
)