SQL Query Every Minute

Biostar / CUSTOM
August 21, 2009 at 13:22:06
Specs: WinServ08, 4GB
I would like to know if this is possible. Then if it is possible how would you go about solving it.

Currently we have a database logging an event every few seconds. We would like this rate to countinue because it is needed in other business areas, but for our business area we do not need data logged this often.

Instead we would like a SQL statement that would pull a data entry every minute. So for example if the time stamps fall within the range below we would like only one value recorded per the below series.

2009-08-21 14:00:29.527
2009-08-21 14:00:40.157
2009-08-21 14:00:41.460
2009-08-21 14:00:47.670
2009-08-21 14:00:48.970
2009-08-21 14:00:57.683

The SQL statement would need to contain this logic. A script may be better? As stated above I do not know if this is possible or how one would go about doing this.

Let me know if you have any more questions or thoughts on this matter.


See More: SQL Query Every Minute

Report •

August 21, 2009 at 14:11:40
It would depend on the database, but your solution would probably be based on SQL's "GROUP BY" function and whatever date/time functions your database provides.

Report •

August 23, 2009 at 17:35:21
Yes it is more than that.

I would need a SQL statement that can count 'intervals' of a minute time period.

So for example if an event occurred at:

Only two time stamps would be recorded out of the given series.

I was thinking a stored procedure or script function but I am unsure of how to approach it.

Thanks for your help thus far.

Report •

Related Solutions

Ask Question