sql query relative time

brain nearly engaged, but full of a head cold. Screams looks closest to what would work, but is formatted a little wrong I think for the datetime, as someone else posted, datetime should be enclosed with a # not a '. Give that a whirl, failing that take a look on codeproject, there are some c# apps there that have sql code builders in them, they have a varying amount of success rate depending on what you want, but when done properly those little ‘helper’ apps for sql are real jems :slight_smile:

have a look at this one, there seems to be a relevant example for what you want on the page !
http://www.codeproject.com/KB/database/SelectQueryBuilder.aspx

DT.

:confused: I don’t think anyone is dealing with his amended requirement looks like everyone is still putting up solutions for his 1st original question which he got working code to execute.

… I am getting confused so I have to assume its 1000 times worse for…Wytrblue.


Anyhow using the code we knew worked… If you have no end time and only the Call time and duration you will need to roll back the Calltime 5 mins or do a result combine into a new array ((Beyond my know how)) then maybe in your 2nd Query increase the Callduration to 300 ((Assuming its recorded as pure seconds)) i.e. longer than 5 mins then tell it to order by Call Duration.

Hopefully this will do what I mention above… its all really tweaking the data to fit… not quite sure what your truly after yet ?

SELECT     calltime, callduration
FROM         (
                          SELECT     *
                           FROM         Calls
                           WHERE     calltime > '01-dec-2008 13:10' AND calltime < '01-dec-2008 13:31' )
WHERE     callduration > 300
ORDER By Callduration

That should give all calls greater than 5 min from 13:10 upto 13:31

Just amend the call duration if you want longer call times.

[QUOTE=DoubleTop;430632]brain nearly engaged, but full of a head cold. Screams looks closest to what would work, but is formatted a little wrong I think for the datetime, as someone else posted, datetime should be enclosed with a # not a '.
http://www.codeproject.com/KB/database/SelectQueryBuilder.aspx

DT.[/QUOTE]

Depends what SQL you’re working on.

Microshite SQL server 2000 or 2005 uses ’ *:sunglasses:

How is the duration field set up? (datetime / Number?)

pmm that looks like it might do what i need,

i cant really explain it well without going into vast detail about what our software actualy does and instantly becoming the least liked person on the forums :smiley:

i will post a screen shot of table tomorow when im back at work. i sat down with a pad and pen for a few hours this morning and just worked it out…

thanks again for the tips folks :slight_smile: