• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 188
  • Last Modified:

Query that returns data that is staggered

I have a database that has 50,000 records from a remote field device. These readings are every 16 seconds, and are stored as such in the database. What I am wondering is if there is a query that I can do that will return the reading at every hour? I am currently running the query with the device ID, and getting all readings. The column for date and time is the datetime format.

Thanks,

Brad
0
bradbritton
Asked:
bradbritton
1 Solution
 
Aneesh RetnakaranDatabase AdministratorCommented:
reading during last hour

Select
WHERE DATEDIFF(hh,urDateTimeColumn,GETDATE()) = 1
0
 
SireesCommented:
You can create a job with your query and schedule it to run every one hour.
0
 
HuyBDCommented:
Try to use "WAITFOR DELAY"

e.g.

while 1<>2
begin
 WAITFOR DELAY '00:01:00'
 --quey here
end
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now