Hello,
I have a column in a SQL table that is the times that measurements were made. As shown in Table1 below, the measurement times can be out of sequence, repeated, or irregularly sampled (they are generally but not always 100 milliseconds apart). When the time stamp is missing (like 2009-12-20 11:59:56.1 in the example below), that means we did not make a measurement. So, I need to know the total amount of time over which we made measurements. That could be approximated as the count of unique _TimeStamp values multiplied by the typical time stamp (100 milliseconds). How do I write this query? It could have to run over a lot of records (30 days sampled at ~100 ms), if that affects the solution. Thanks!
Table1:
_TimeStamp
2009-12-20 11:59:56.0
2009-12-20 11:59:56.5
2009-12-20 11:59:56.3
2009-12-20 11:59:56.4
2009-12-20 11:59:56.4
2009-12-20 11:59:56.9