Delete Statement with MultiPart Key

  • Ladies / Gentlemen

         Here is the Delete statement that I would like to emulate, but I need to do it with a multipart key.

         Delete from TableA

                   where TableA.ID

                   in ( Select TableB.Id from TableB )

         The Four part key consists of the following fields

              StoreId               int

              VendorNumber    int

              ItemNumber       char(15)

              PLUNumber         bigint

         So I need to match

    TableA.StoreID           : TableB.StoreID

    TableA.VendorNumber : TableB.VendorNumber

    TableA.ItemNumber     : TableB.ItemNumber

    TableA.PLUNumber      : TableB.PLUNumber

    Thanks in advance

    Mark Moss

  • DELETE FROM TableA

    WHERE EXISTS (

     SELECT *

     FROM TableB

     WHERE StoreID = TableA.StoreID

     AND VendorNumber = TableA.VendorNumber

     AND ItemNumber = TableA.ItemNumber

     AND PLUNumber = TableA.PLUNumber)

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

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