Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
T-SQL (SS2K8)
»
Cumulative sum based on criteria
Cumulative sum based on criteria
Rate Topic
Display Mode
Topic Options
Author
Message
azoorob
azoorob
Posted Monday, February 04, 2013 3:07 PM
Forum Newbie
Group: General Forum Members
Last Login: Tuesday, February 05, 2013 11:20 AM
Points: 2,
Visits: 1
Hey all,
I am trying to go through this table (see attached), and then for every change in LOC_Zone, record the average amount of time that a certain loczone takes up. For example, for the UTILGLAVA loc_zone I would need to sum the amount of time that has passed until the next loc zone appears (in this case 29102). I would then sum the amount of time spent in 29102 until the next loc zone (integeosc). The process would repeat with the average time spent in each loc_zone being my final desired result.
Is this possible to do in sql alone, or do I need to use some other scripting language?
Thanks for your help guys!
-Andrew
Post Attachments
table.JPG
(
7 views,
609.96 KB
)
Post #1415509
bitbucket-25253
bitbucket-25253
Posted Monday, February 04, 2013 3:32 PM
SSCertifiable
Group: General Forum Members
Last Login: Yesterday @ 9:02 PM
Points: 5,100,
Visits: 20,195
You should know that those who want to help you are more than likely to be at their work place ... working .... could you supply the table definition, a small amount of data ...
in an easily useable format
. To do that click on the first link in my signature block and the article that will display has sample T-SQL code that will let you do that quickly and easily.
If everything seems to be going well, you have obviously overlooked something.
Ron
Please help us, help you -before posting a question please
read
Before posting a performance problem please
read
Post #1415513
azoorob
azoorob
Posted Tuesday, February 05, 2013 11:20 AM
Forum Newbie
Group: General Forum Members
Last Login: Tuesday, February 05, 2013 11:20 AM
Points: 2,
Visits: 1
I'm sorry. Thanks alot for letting me know. Tomorrow when I am back at work I will correctly post the data. I appreciate your help.
-Andrew
Post #1416011
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.