question

zohan avatar image
zohan asked

Sum of table Moved

Helo i have this Q> Gold_Cest .................. .Membe_id . Gold . .................. .John . 5 . .................. .Yvan . 10 . .................. .Sam . 100 . .................. Castle_Data ...................................................... ............... .Membe_id | Ocupy| Date | Cest | .....................................................................| .Event | 1 | 24/04/2014 12:00| Sum(*) of Gold_Cest Table Gold | ...................................................................... So wat i want the sum of Gold cest table gold moved in Castle_Data table Cest
tablesummove
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

JohnM avatar image JohnM commented ·
Forgive me as I don't quite understand the question. You are looking for a way to sum the amount of gold (from the Gold_Cest table) for each member in the Castle_Data table? IE: For the .Event member you want the total amount of gold?
0 Likes 0 ·

1 Answer

·
Squirrel avatar image
Squirrel answered
This is what you want ? INSERT INTO Castle_Data (Membe_id, Ocupy, Date, Cest) SELECT 'Event', 1, '2014-04-24 12:00', SUM(Gold) FROM Gold_Cest
3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

zohan avatar image zohan commented ·
and if i dont want to insert any information to other ids i will set like this Insert intro Castle_data (Cest) Select Sum(gold) From Gold_Cest
0 Likes 0 ·
zohan avatar image zohan commented ·
and then delete all the info behind so Insert intro Castle_data (Cest) Select Sumsqasa(gold) From Gold_Cest Set Gold = 0 from Gold_Chest
0 Likes 0 ·
Squirrel avatar image Squirrel commented ·
Begin Trans Insert intro Castle_data (Cest) Select Sum(gold) From Gold_Cest Update Gold_Chest Set Gold = 0 Commit Trans
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.