SQL update query using joins

Posted by Shyju on Stack Overflow See other posts from Stack Overflow or by Shyju
Published on 2009-06-11T18:49:33Z Indexed on 2010/05/13 6:04 UTC
Read the original article Hit count: 356

Filed under:
|
|
|
|

I have to update a field with a value which is returned by a join of 3 tables.

Example:

select
    im.itemid
    ,im.sku as iSku
    ,gm.SKU as GSKU
    ,mm.ManufacturerId as ManuId
    ,mm.ManufacturerName
    ,im.mf_item_number
    ,mm.ManufacturerID
from 
    item_master im, group_master gm, Manufacturer_Master mm 
where
    im.mf_item_number like 'STA%'
    and im.sku=gm.sku
    and gm.ManufacturerID = mm.ManufacturerID
    and gm.manufacturerID=34

I want to update the mf_item_number field values of table master with some other value which is joined in the above condition.

How to frame the SQL ?

© Stack Overflow or respective owner

Related posts about sql

Related posts about tsql