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 2000 Forums
 Transact-SQL (2000)
 Query help

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-08-16 : 07:57:56
Joel Collazo writes "Hi guys this just wondering if you can help with a query that i try to do...

This is the following query i ran between the following time frame:


select xpitordernumber,RoutingCode, Tssubmitted from WorkingOrders

WHERE Tssubmitted BETWEEN '2005-07-29 04:38:12.760' AND '2005-07-29 05:06:33.930'

Result is below:

Xpitordernumber RoutingCode Tssubmitted
1111115 9 2005-07-29 04:38:12.760
1111116 9 2005-07-29 04:43:50.387
1111117 9 2005-07-29 04:43:50.400
1111118 9 2005-07-29 04:43:55.010
1111119 9 2005-07-29 04:50:51.480
1111120 9 2005-07-29 04:51:28.090
1111121 9 2005-07-29 05:06:33.917
1111122 9 2005-07-29 05:06:33.930


Now what i would like to do is do a query to query only that match the date, hour, minutes and seconds... I can care less for Mseconds. For example i just want to see orders that match with thoses following so it would be xpitordernumber 1111116 and 1111117. also 1111121 and 1111122. It would look like something like this:


Xpitordernumber RoutingCode Tssubmitted
1111116 9 2005-07-29 04:43:50.387
1111117 9 2005-07-29 04:43:50.400
1111121 9 2005-07-29 05:06:33.917
1111122 9 2005-07-29 05:06:33.930


Any ideas? I know this is kind of vague.. but im sorry please write me if you have any questions. So basically i would like to see any order that hit are system(tssubmitted) with the same SECOND and date not millseconds. To see how many orders we get in 1 second at times within a certain time frame.

Thanks"

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2005-08-17 : 07:51:40
select a_row
from your_table a
where exists(
select a_row
from your_table b
where datediff(s,a.datetime, b.datetime) = 0)

Something like that ...

Jay White
Go to Top of Page
   

- Advertisement -