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 |
zrw
Starting Member
4 Posts |
Posted - 2012-06-26 : 09:45:34
|
Hi, I am having one of those days, I just cant think...I have the following fields LoggedDate,ResolvedDate,IDI would like to list all the records that were open at a point in time... eg ResolvedDate of 1753 or resolved after or before the selected dateand logged before the selected dater1 10/02/2010 11:53:53 1/01/1753 00:00:00r2 11/02/2010 11:53:53 11/02/2010 11:00:00r3 12/02/2010 11:53:53 14/02/2010 13:00:00r4 13/02/2010 11:53:53 15/02/2010 09:00:00r5 14/02/2010 11:53:53 1/01/1753 00:00:00Therefore if i select the 12/02/2010 it will count r1 and r3 onlyHope this is enough info? |
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2012-06-26 : 11:50:24
|
WHERE LoggedDate <= '20101202' and (ResolvedDate >= '20101202' or ResolvedDate = '17530101')JimEveryday I learn something that somebody else already knew |
 |
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2012-06-26 : 11:58:43
|
quote: resolved after or before the selected date
Does that mean you only want Resolved dates not equal to the selected date (12/02/2010) or can that predicate really be ignored? |
 |
|
zrw
Starting Member
4 Posts |
Posted - 2012-06-27 : 08:47:50
|
jimf i tried that and I get the correct logged date, but the resolve date only returns 1753 not and job that was added prior to the date but closed after the selected date.Lamprey if the call was logged prior to the selected date, though closed after the selected date then i want to see it... |
 |
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2012-06-27 : 09:14:28
|
Slight change to mineWHERE LoggedDate < '20101302' and (ResolvedDate >= '20101202' or ResolvedDate = '17530101')I didn't take the time element into consideration! This gives what you originally asked for.JimEveryday I learn something that somebody else already knew |
 |
|
|
|
|