[QUOTE=wyntrblue;430566]hiya folks,
the new job is prooving to be a challenge and now i have run into a problem i cannot solve on my own, so i turn to you wise people…
i have a database (sql 2000)
the important fields are “calltime” and “callduration”
i need to work out how meny calls occured between
1-dec-2008 13:15 and 1-dec-2008 13:30
that total time was longer than 60seconds but relative
eg
call comes in at 13:14 but takes 20mins that needs to show up in the results. any ideas what the query is gonna be coz im stumped
thanks loads for your insight :D[/QUOTE]
Can I just ask. If you are picking a query to search between 13:15 and 13:30, you are not going to pick up any calls that start at 13:14.
To pick up calls that are between those start times, you would need the following:
Assumptions: Table name is called: CALLS
select calltime, callduration, * from CALLS (nolock)
where calltime between ‘01-dec-2008 13:15’ and ‘01-dec-2008 13:30’
This will pick up the calls between those start times. If you want to pick up all the calls between those start times and anything over 60 seconds regardless of the start time, you’ll need something more like this:
select calltime, callduration, * from CALLS (nolock)
where ((calltime between ‘01-dec-2008 13:15’ and ‘01-dec-2008 13:30’)
or callduration > 60))
This will pick up all calls where the calltime is between 13:15 & 13:30 and all calls on any day where the duration was greater than 60 seconds.
This all depends on the setup of the fields in the database. Can you let me know how the duration field is set up, (ie, datetime/text/number?)
PM the information and I’ll sort it for you. (after all, I do sql on a daily basis for my job!)