Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Half hour should not exceed 30 m
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

1 Posts

Posted - 03/18/2014 :  01:31:38  Show Profile  Reply with Quote
Dear sir,

Please see below control panel statics,

cp start_time stop_time
2 15-03-2014 23:58 15-03-2014 23:57
1 16-03-2014 01:11 15-03-2014 23:57
2 16-03-2014 01:09 15-03-2014 23:58
3 15-03-2014 23:59 15-03-2014 23:59

I want to write sql statement which will return result only for every 30 mins.

For. example -
SELECT id, CP,, Start_Time, Stop_Time FROM tablename WHERE (Stop_Time BETWEEN '2014-03-15 23:30:00.000' AND '2014-03-15 23:59:59.000')

Please suggest asap.



Edited by - techfortune on 03/18/2014 01:39:41

Aged Yak Warrior

737 Posts

Posted - 03/18/2014 :  08:21:41  Show Profile  Send ahmeds08 a Yahoo! Message  Reply with Quote
SELECT id, CP,, Start_Time, Stop_Time FROM tablename
where DATEDIFF(Minute, '2014-03-15 23:30:00.000', '2014-03-16 00:00:00.000')=30

Javeed Ahmed
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000