jnelson993
Posts: 900
Score: 127 Joined: 2/18/2005 From: Minneapolis, MN Status: offline
|
No, what I'm saying is, with the LESS THAN instead of the GREATER THAN, you are already returning only those records that haven't returned a HW scan for 30 days or greater. Look at the comparison statement: SMS_G_System_WORKSTATION_STATUS.LastHardwareScan <= DateAdd(dd,-30,GetDate()) This says, for every LastHardwareScan record in the SMS_G_System_WORKSTATION_STATUS class on the left side of <= , return those with a date that's less than whatever is on the right side of <=. Perhaps it would help to use some real values Let's say you have the following values in LastHardwareScan 2008-07-17 12:07:20.350 2008-08-17 12:07:20.350 2008-09-17 12:07:20.350 And let's assume the current date is 2008-09-17 12:07:20.350 So when the records get evaluated, it will use that comparison statement you have. So let's use the values above and substitute them into the statement First, let's replace SMS_G_System_WORKSTATION_STATUS.LastHardwareScan with the first value: 2008-07-17 12:07:20.350 Next, let's evaluate that DATEADD stuff on the right DateAdd(dd,-30,2008-09-17 12:07:20.350)becomes 2008-08-18 12:07:20.350 (which is today MINUS 30 days) So, is 2008-07-17 12:07:20.350 really less than or equal to 2008-08-18 12:07:20.350? The answer is yes, the record is less than, so that record shows up. Moving on to the next sample value, is 2008-08-18 12:07:20.350 really less than or equal to 2008-08-18 12:07:20.350? The answer is yes, they're equal, so that record shows up. Now the last sample value...is 2008-08-18 12:07:20.350 really less than or equal to 2008-09-18 12:07:20.350? The answer is no, it's greater than, so that record DOES NOT show up. This make any sense?
< Message edited by jnelson993 -- 9/17/2008 1:24:48 PM >
_____________________________
Number2 (John Nelson) MyITForum - Blog MyITForum - Forum Posts
|