Results 1 to 4 of 4

Thread: Update Query

  1. #1
    Join Date
    Sep 2010
    Posts
    153

    Smile Unanswered: Update Query

    I have two tables..

    table 1..

    product | actual_quantity | required_quantity

    A 10
    B 12
    C 11





    TABLE 2:-

    product | required_quantity
    A 5
    A 5
    A 10
    B 5
    B 15
    C 20
    C 10



    1) I want to calculate the sum of required quantity from table 2 group by products.

    ex, A = 20
    B = 20
    C = 30

    I WANT TO update these values in TABLE 1, where we have products A, B and C.

    we hace to mao products columns and update values from table B into table A .




    desired result :-


    TABLE 1 :-


    product | actual_quantity | required_quantity
    A 10 20
    B 12 20
    C 11 30

    Thanks guys

  2. #2
    Join Date
    Sep 2010
    Posts
    153
    kindly try to solve it i need urgent help.

  3. #3
    Join Date
    Sep 2010
    Posts
    153
    guys, leave it..deadline is gone..i had no othr option ..i wrote a small procedure for it.

    Thanks a lot for your time

  4. #4
    Join Date
    Jul 2011
    Posts
    2

    Try this one and let me know if it works. please share the procedure

    update table1 set required_quantity=(select b.required_quantity from (select product,required_quantity from table2 group by product,required_quantity)b) where
    table1.product=b.product

Posting Permissions

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