Results 1 to 5 of 5

Thread: get sum from update into temp table????

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2000
    Location
    bebenia, PA, USA
    Posts
    241
    how do i get the sum of the qty item for a particular item. For example I am trying to get a total for the amount cancelled on a particular item. So say if they order 50 and they cancel 49. I want to get 49 back as a sum for each item?????? going into a temp table???



    UPDATE wd
    set wd.qty_cancelled = l.qty
    from #workingdata wd
    INNER join lala l
    ON wd.item= l.item
    WHERE l.status = 'cancelled'

  2. #2
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Leavenworth KS USA
    Posts
    482
    Ah, too other DB on the brain, disregard my last...

    [Edited by Mongo on 06-14-2000 at 09:21 PM]

  3. #3
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    with SQL 7/northwind DB

    select Sum(OrderID) as sumOfOrderID into WD1 from Orders where orderid between 10248 and 10275 (and other criteria here)

    This will create the table named WD1 for your use for whatever

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Mar 2000
    Location
    bebenia, PA, USA
    Posts
    241
    could you do an example of this using an ansi join that would be great thanks,



    [Edited by Bebe on 06-14-2000 at 11:53 PM]

  5. #5
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    what are your table structures? I could do an example that might help, but I'd rather do one that will


Posting Permissions

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



Click Here to Expand Forum to Full Width