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

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Half hour should not exceed 30 m

Author  Topic 

techfortune
Starting Member

1 Post

Posted - 2014-03-18 : 01:31:38
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.

Regards,
TFS

TFS

ahmeds08
Aged Yak Warrior

737 Posts

Posted - 2014-03-18 : 08:21:41
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
   

- Advertisement -