Hi all,
I have the following tables and need to update data between them:
TableA
Desc PrevQty
abc
def
ghi
xyz
TableB
Desc Qty
abc 10
def 15
ghi 20
abc 30
xyz 10
I need help with a query to get the total Qty from tableB and update the PrevQty in TableA.
When the query is run, TableA should look like this:
TableA
Desc PrevQty
abc 40
def 15
ghi 20
xyz 10
so far I have this for the query:
SELECT Desc, sum(Qty) as TotalQty
FROM TableB
Group By Desc;
This obviously gives me the total qty for each desc - the trouble I am having is combining this with an update query to modify TableA - I hope I am half way there There is every possibility that what I have started with is wrong!!
Any help or guidance offered is greatly appreciated.
Thanks
I have the following tables and need to update data between them:
TableA
Desc PrevQty
abc
def
ghi
xyz
TableB
Desc Qty
abc 10
def 15
ghi 20
abc 30
xyz 10
I need help with a query to get the total Qty from tableB and update the PrevQty in TableA.
When the query is run, TableA should look like this:
TableA
Desc PrevQty
abc 40
def 15
ghi 20
xyz 10
so far I have this for the query:
SELECT Desc, sum(Qty) as TotalQty
FROM TableB
Group By Desc;
This obviously gives me the total qty for each desc - the trouble I am having is combining this with an update query to modify TableA - I hope I am half way there There is every possibility that what I have started with is wrong!!
Any help or guidance offered is greatly appreciated.
Thanks