累计数据总和 [英] Sum Accumulating Data

查看:70
本文介绍了累计数据总和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张包含一列累积正常运行时间数据的表格

看起来与此类似:


239.13

239.21

239.30

239.38

239.46

239.55

0.35

0.44

0.53

0.60

0.68

0.78

0.85

0.93

我需要将数据汇总到数据重置点(下一行

行)小于前一行)。然后我再次启动SUM,直到

数据重置。


提前感谢您的帮助!

I''ve got a table that contains a column of accumulating uptime data
that looks similar to this:

239.13
239.21
239.30
239.38
239.46
239.55
0.35
0.44
0.53
0.60
0.68
0.78
0.85
0.93

I need to SUM the data up the point where the data gets reset (the next
row is less than the preceeding row). Then I start the SUM again until
data gets reset.

Thanks in advance for help!

推荐答案

没有主键,几乎无法完成。数据不会存储在任何特定订单中,因此就SQL Server而言,您给我们的值列表




0.35

0.44

0.53

0.60

0.68

0.78

0.85

0.93

239.13

239.21

239.30

239.38

239.46

239.55

-

Tom


---------------------------------------- ------------

Thomas A. Moreau,理学士,博士,MCSE,MCDBA

SQL Server MVP

加拿大多伦多

..

< su ****** @ gmail.com>在留言中写道

news:11 ********************** @ g10g2000cwb.googlegr oups.com ......

我有一张桌子,其中包含一列累积的正常运行时间数据

看起来与此类似:


239.13

239.21

239.30

239.38

239.46

239.55

0.35

0.44

0.53

0.60

0.68

0.78

0.85

0.93

我需要将数据汇总到数据重置的位置(下一个

row小于前一行)。然后我再次启动SUM,直到

数据重置。


提前感谢您的帮助!

Without a primary key, little can be done. The data aren''t stored in any
particular order, so as far as SQL Server is concerned, the list of values
you have given us is no different from

0.35
0.44
0.53
0.60
0.68
0.78
0.85
0.93
239.13
239.21
239.30
239.38
239.46
239.55
--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
..
<su******@gmail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
I''ve got a table that contains a column of accumulating uptime data
that looks similar to this:

239.13
239.21
239.30
239.38
239.46
239.55
0.35
0.44
0.53
0.60
0.68
0.78
0.85
0.93

I need to SUM the data up the point where the data gets reset (the next
row is less than the preceeding row). Then I start the SUM again until
data gets reset.

Thanks in advance for help!


抱歉,有一个主键,只是没有显示它。

Sorry, there is a primary key, just didn''t show it.


你还有日期/时间信息吗?是什么决定了数据的实际顺序

?如果没有发布DDL,我们就可以猜测了。


-

Tom


---- ------------------------------------------------ <无线电通信/>
Thomas A. Moreau,理学士,博士,MCSE,MCDBA

SQL Server MVP

加拿大多伦多

。 。

< su ****** @ gmail.com>在消息中写道

news:11 ********************** @ u72g2000cwu.googlegr oups.com ...

对不起,有一个主键,只是没有显示它。

DO you also have date/time information? What determines the actual sequence
of the data? Without posting the DDL, we are left to guess.

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
..
<su******@gmail.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
Sorry, there is a primary key, just didn''t show it.


这篇关于累计数据总和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆