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.
| Author |
Topic |
|
rico16135
Starting Member
11 Posts |
Posted - 2008-04-17 : 23:18:56
|
| I need a query to return the number of distinct call_num(s) between two timestamps. For example search between 2008-04-17 05:00:00.000 and2008-04-19 05:00:00.000Calls----------id_tag(unique id) | status | call_num | entry_id(timestamp)1 HOLD 0123456789 2008-04-17 05:07:00.0802 ONSCENE 012345679 2008-04-17 05:10:00.0123 ENROUTE 321654987 2008-04-19 04:00:00.000so the sample answer would be : 2 |
|
|
rico16135
Starting Member
11 Posts |
Posted - 2008-04-17 : 23:21:21
|
| sry I inserted two calls with similar call_num in the example, picture a 4th entry with a different call_num between the two times. |
 |
|
|
pravin14u
Posting Yak Master
246 Posts |
Posted - 2008-04-18 : 00:06:27
|
| Select count(distinct call_num) from tablename where entry_id between STARTDATE(2008-04-17 05:00:00.000) and ENDDATE(2008-04-19 05:00:00.000)Prakash.PThe secret to creativity is knowing how to hide your sources! |
 |
|
|
|
|
|