Update field with value from another table

UPDATE table_1 AS t1, table_2 AS t2
  SET
    t1.name = t2.title,
    t1.descr = t2.description,
    t1.price = t2.price,
    t1.available = t2.stock
  WHERE t1.productId = t2.sku

Taken from forum while browsing to find for solution. This query will took some time when dealing with thousands record in both table.

Facebook Twitter Email

Leave a Comment


1 − 1 =


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>