Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
|
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 29th, 2006, 06:51 AM
Registered User
 
Join Date: Aug 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Phathu
Default selecting data in datetime intervals

Hi guys

I have a table with some data
eg

       dtime | dat1 | dat2 | dat3
2000-12-12 12:23:45.777 | 0.66 | 0.544| 7
2000-12-12 12:23:47.777 | 54 | 56 | 0.99
2000-12-12 12:23:50.777 | 210 | 44 | 212
2000-12-12 12:23:52.777 | 0.21 | 45 | 0.11
2000-12-12 12:23:58.777 | 12 | 0.24 | 75
2000-12-12 12:24:01.777 | 34 | 4 | 0.22
2000-12-12 12:24:05.777 | 54 | 785 | 45
2000-12-12 12:24:08.777 | 2 | 20 | 21
...


lets say i want to SELECT all the data in an interval of
5sec. not evrything in between but every 5seconds
can anyone help me

 
Old August 29th, 2006, 03:53 PM
SQLScott's Avatar
Wrox Author
 
Join Date: Dec 2004
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Look at the DATEPART function. It will take a little work but it is doable. For example, grab the first value, then use the DATEPART function to add 5 minutes to that value. Then loop through the results looking for that value. When found, use the DATEPART function again to add 5 minutes and loop again, repeating the process. There is probably a way to do this without looping, but this is just the first thing that came to mind.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Reporting on Time intervals Brendan Bartley Access 11 November 26th, 2008 01:14 AM
Selecting Data from a table nkrust Javascript 7 January 11th, 2007 05:44 AM
Selecting data using axis in predicate Chamkaur XSLT 1 July 9th, 2006 01:02 PM
Chapter 6 Selecting Data in Access ,, Help Me zaidqais BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 2 May 5th, 2006 03:48 AM
Selecting Data.. NitinJoshi General .NET 3 January 18th, 2005 02:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.