Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to make an resume of datetime changes

Author  Topic 

voyager838
Yak Posting Veteran

90 Posts

Posted - 2009-05-22 : 04:23:39
Hi

I want to do an "report" from an table

Lets assume that i using this table

DateTime, Field
'2008-01-01 00:00:00',NULL
'2008-01-01 00:03:00','3.4
'2008-01-01 00:09:00','5.4
'2008-01-01 00:12:00',NULL
'2008-01-01 00:15:00',NULL
'2008-01-01 00:16:00','3.4
'2008-01-01 00:17:00','5.4
'2008-01-01 00:20:00',NULL

Then i want to perform a result/table (report) like this

StartsFrom ; HowLongInMinutes ; Value
2008-01-01 00:00:00 3 , NULL
2008-01-01 00:03:00 9 , NOT NULL
2008-01-01 00:12:00 4 , NULL
2008-01-01 00:16:00 4 , NOT NULL
2008-01-01 00:20:00 , NULL


Its kind of an resume of how long every "changes" of value
is keep going.


Regards
Voy

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-05-22 : 04:30:02
http://www.sqlteam.com/article/detecting-runs-or-streaks-in-your-data
Go to Top of Page

voyager838
Yak Posting Veteran

90 Posts

Posted - 2009-05-22 : 04:37:55
Thanks for the link Visakh16!

That's really comes in handy.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-05-22 : 04:47:45
welcome
Go to Top of Page
   

- Advertisement -