Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Idle Time

Status
Not open for further replies.

lfcmd

Programmer
May 3, 2006
14
IE
Hi Group,

I have a database which gets a record wriiten to it once every minute for each indvidual fone on are system but only if the fone is in use, if the fone is not in use no record is written to the database

What i am trying to do is
Select the overally time, between set dates, that a fone was not in use

Any help would be grately apprecitated
 
Some sample data please... with results you want.

------
[small]<this is sig>
select stuff(stuff(replicate('<P> <B> ', 14), 109, 0, '<.'), 112, 0, '/')
</this is sig>[/small]
[banghead]
 
Don't know if this will help you or not.

Code:
Select * from phone

Results
phonelog
---------
441
442
443
444
447
448
449
Code:
select
 a.phonelog as StartIdleTime,
 min(b.phonelog) as EndIdleTime
from
 phone a,
 phone b
where
 a.phonelog<b.phonelog
group by
 a.phonelog
having
 min(b.phonelog)-a.phonelog > 1

Results
StartIdleTime  EndIdleTime
---------------------------
444	       447

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top