Update table based on condition

  • I have 2 tables A- columns id & Amount.

    Table A

    Id Amount

    1 10

    2 20

    3 30

    Another table B columns id,Total_Amount,Product

    Table B

    Id Total_Amount Product

    1 Apple

    3 Mango

    5 Orange

    Now I want to update B with the Amount in A where A.id=B.Id

    can u give me a script for this in MS SQL server 2000.I am a newbie.

  • Hi!

    UPDATE B SET B.Total_Amount=A.Amount

    FROM A AS A INNER JOIN B AS B ON

    A.Id=B.Id

  • Hi thanks.it worked.

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

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