Beginner Update Query Question

  • CREATE TABLE [tablea] (

    [productid] [int] IDENTITY (1, 1) NOT NULL ,

    [category] [varchar] (2) NULL ,

    [shortsku] [varchar] (5) NULL ,

    [edp] [varchar] (50) NULL ,

    [type] [varchar] (2) NULL ,

    [productname] [varchar] (200) NULL ,

    [price] [money] NULL ,

    ) ON [PRIMARY]

    GO

    i have around 5000 records. i need to run an update query that will find

    rows where productname is null and then take the productname from a similar

    shortsku and insert the productname from that record into the null

    productname field. what is the best way to achieve this? thanks


    </cm>

  • Something close to this:

    update B set A.ProdName=B.Prodname from TableWithName A inner join TableWithoutName B on A.sku=b.sku where b.prodname is null

    Andy

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply