Help with query

From: Newbie (noidea_at_nospam.com)
Date: 03/10/04


Date: Wed, 10 Mar 2004 15:23:29 -0000

Hi,

I want to be able to update a field in one table with the sum of a field
from another table but i don't know how to link the two

Here is what I have so far to get the TotalQty
*****TOTAL QRY*****
SELECT SalesOrder,SUM(OrderQty) AS TotalQty
FROM SODet
WHERE (SalesOrder = '12345') AND (Line = '1')
GROUP BY SalesOrder

I then want to use the result of the above to update the SO table where the
SO.SalesOrder = SODet.SalesOrder

i.e Result of TOTAL QRY = 30000
therefore SO.Total = 30000

How can I do this?
Thanks



Relevant Pages

  • Re: Help with query
    ... GROUP BY SalesOrder) ... Rohtash Kapoor ... "Newbie" wrote in message ... > Here is what I have so far to get the TotalQty ...
    (microsoft.public.sqlserver.mseq)
  • Re: Help with query
    ... where would the join expression be? ... "Rohtash Kapoor" wrote in message ... > GROUP BY SalesOrder) ... >> Here is what I have so far to get the TotalQty ...
    (microsoft.public.sqlserver.mseq)