You basically need to have each time range in data somewhere. There are a couple of ways to do this. One is to have every time range in a table and left outer join from that to the time from your data between with the timestamp between the start and end of the range. Another way is to create a stored procedure that will return a dataset that contains all of the time ranges and, again, left outer join from that to your data with the timestamp between the start and end of your range. This means that the time range data set needs to be in something like the following format:
Start_Date End_Date
-------------- -------------
22.04.2010 08:00:00 22.04.2010 08:29:59
22.04.2010 08:30:00 22.04.2010 08:59:59
etc...
-Dell
Edited by hilfy - 27 Apr 2010 at 4:15am