Results 1 to 2 of 2

Thread: Updates to Multiple Records

  1. #1
    Beau Lendman Guest

    Updates to Multiple Records

    Is it possible to do an update on multiple records. I have fields CusOrderID and CusCreditAmt in table CusOrder; and fields CusOrderID and CreditAmt in table CusCredits. I would like to update the value in the CusCreditAmt field in CusOrder to equal the CreditAmt field in CusCredits where CusOrderID is the same in both tables.

    I tried doing this in a stored procedure based on a View with an inner join between the 2 tables as follows:

    Update View1
    Set CusCreditAmt = CreditAmt

    I received an error that the subquery returned more than one value. Is there anyway to do something like this and make it work?

    Many thanks for any advice.

  2. #2
    John Guest

    Updates to Multiple Records (reply)

    You could try something like this. I cannot look into it, but if memory serves, this may work..John

    UPDATE CusOrder SET CusCreditAmt = CreditAmt FROM CusCredits
    WHERE CusOrder.CusOrderID = CusCredits.CusOrderID
    (given CusOrderID is unique)


    ------------
    Beau Lendman at 3/9/2002 11:47:49 AM

    Is it possible to do an update on multiple records. I have fields CusOrderID and CusCreditAmt in table CusOrder; and fields CusOrderID and CreditAmt in table CusCredits. I would like to update the value in the CusCreditAmt field in CusOrder to equal the CreditAmt field in CusCredits where CusOrderID is the same in both tables.

    I tried doing this in a stored procedure based on a View with an inner join between the 2 tables as follows:

    Update View1
    Set CusCreditAmt = CreditAmt

    I received an error that the subquery returned more than one value. Is there anyway to do something like this and make it work?

    Many thanks for any advice.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •