本文介绍了多个表的SQL存储过程SUM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我正在使用这种格式的几张桌子:



- dbo.January-

用户状态

=================

user1 123

user2 456



-dbo.February-

用户状态

== ===============

user1 149

user2 987



-dbo.YearToDate-

用户状态

=================

user1 ????

user2 ???



我想写一个存储过程,可以总结本月每个用户的统计数据表并将总数更新到YearToDate表。



我觉得应该很容易写,但我不知道如何开始。任何人都可以指出我正确的方向或有一些片段/例子吗?



谢谢你,非常感谢你的帮助!

Hello,

I'm working with a few tables with this format:

-dbo.January-
USER STATS
=================
user1 123
user2 456

-dbo.February-
USER STATS
=================
user1 149
user2 987

-dbo.YearToDate-
USER STATS
=================
user1 ???
user2 ???

I want to write a stored procedure that can sum up the stats for each user in the Month tables and update the total to the YearToDate table.

I feel should be easy to write, but I'm not sure how to start. Can anyone point me in the right direction or have some snippet/example?

Thank you, your help is much appreciated!

推荐答案




这篇关于多个表的SQL存储过程SUM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 03:06