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 2000 Forums
 Transact-SQL (2000)
 Help to develop logic for following data and repor

Author  Topic 

jsquare
Starting Member

1 Post

Posted - 2007-07-13 : 13:43:06
[code]ID StartTime Status[/code]
[code]1 2007-07-12 07:45:43.000 Fail[/code]
[code]2 2007-07-12 07:50:04.000 Pass[/code]
[code]3 2007-07-12 07:55:04.000 Fail[/code]
[code]4 2007-07-12 08:00:04.000 Fail[/code]
[code]5 2007-07-12 08:05:02.000 Fail[/code]
[code]6 2007-07-12 08:10:02.000 Pass[/code]
[code]7 2007-07-12 08:15:02.000 Fail[/code]
[code]8 2007-07-12 08:20:02.000 Fail[/code]
[code]9 2007-07-12 08:25:02.000 Fail[/code]
[code]10 2007-07-12 08:30:03.000 Fail[/code]
[code]11 2007-07-12 08:35:03.000 Fail[/code]
[code]12 2007-07-12 08:40:03.000 Fail[/code]

I would like to make a report if there at least 3 continuous fails at particular time instance. For example in above data at 2007-07-12 07:55:04.000 there is Fail status and then next 2 rows are also having Fail status.
then I need time difference here it is 10 min duration(07:55 and 08:05)

At another instance at 08:15 there Fail status followed by another 5 rows.

So need to have logic to implement this.

Please help me

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-07-13 : 15:19:10
Are the values in ID column always sequential and there will never ever be gaps in the sequence?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -