query update help

  • i have a table like :

    id name amount type

    1 a 120 x

    2 a 120 x

    3 c 120.41 y

    i need to deduct amount equals to amount of a from name c. i need to use only quey not

    t sql block pls help....

  • When posting a question you should provide:

    A) Table definition

    B) Sample data

    C) Expected output based on sample data

    You (sort-of) provided A and B: now we need C to be able to help.

    Here's how you should post A and B to get replies quickly:

    DECLARE @test-2 TABLE (

    id int,

    name char(1),

    amount money,

    [type] char(1)

    )

    INSERT INTO @test-2 VALUES(1, 'a', 120, 'x')

    INSERT INTO @test-2 VALUES(2, 'a', 120, 'x')

    INSERT INTO @test-2 VALUES(3, 'c', 120.41, 'y')

    So, what's the expected output based on this sample data?

    -- Gianluca Sartori

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

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