cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ToddG
Engaged Sweeper
Either I screwed this up with my own modifications, or it's just like this to begin with, but if I have a computer that is 'not seen in 60 days' - can that not show up in the 30 day report. In other words, I want the 30 day report to only show from day 30-59, and the 60 day report to only show from days 60-89 etc. I don't want to see a computer in my 30 day report, that also appears in my 90 day report. I think it's just a simple greater then or less then modification but not sure how to do it.

Here is my 60 day report - what would I need to change to make sure this only shows days 60-89:

Select Top 1000000 tsysDevicetypes.ItemTypeIcon10 As icon, tblCustDevices.Displayname As [Device name], tblCustDevices.State, tblCustDevices.Model, tblCustDevices.Vendor, tblCustDevices.Location, tblCustDevices.Ipaddress, tblCustDevices.LastSeen, tblCustDevices.DeviceKey From tblCustDevices Inner Join tsysDevicetypes On tsysDevicetypes.ItemType = tblCustDevices.Devicetype Where tblCustDevices.State = 1 And tblCustDevices.LastSeen < GetDate() - 60 Order By tblCustDevices.Displayname
1 ACCEPTED SOLUTION
MikeCC
Engaged Sweeper II
Your current report will only show devices not seen for less than 60 days. If you add the following to your WHERE clause:
(tblCustDevices.LastSeen > GetDate() - 30 AND tblCustDevices.LastSeen < GetDate() - 60)

This will search for devices not seen for greater than 30 days but no more 60 days now.
Select Top 1000000 tsysDevicetypes.ItemTypeIcon10 As icon, tblCustDevices.Displayname As [Device name], tblCustDevices.State, tblCustDevices.Model, tblCustDevices.Vendor, tblCustDevices.Location, tblCustDevices.Ipaddress, tblCustDevices.LastSeen, tblCustDevices.DeviceKey From tblCustDevices Inner Join tsysDevicetypes On tsysDevicetypes.ItemType = tblCustDevices.Devicetype Where tblCustDevices.State = 1 And (tblCustDevices.LastSeen > GetDate() - 30 AND tblCustDevices.LastSeen < GetDate() - 60) Order By tblCustDevices.Displayname

View solution in original post

2 REPLIES 2
ToddG
Engaged Sweeper
Awesome, that worked thanks so much!!
MikeCC
Engaged Sweeper II
Your current report will only show devices not seen for less than 60 days. If you add the following to your WHERE clause:
(tblCustDevices.LastSeen > GetDate() - 30 AND tblCustDevices.LastSeen < GetDate() - 60)

This will search for devices not seen for greater than 30 days but no more 60 days now.
Select Top 1000000 tsysDevicetypes.ItemTypeIcon10 As icon, tblCustDevices.Displayname As [Device name], tblCustDevices.State, tblCustDevices.Model, tblCustDevices.Vendor, tblCustDevices.Location, tblCustDevices.Ipaddress, tblCustDevices.LastSeen, tblCustDevices.DeviceKey From tblCustDevices Inner Join tsysDevicetypes On tsysDevicetypes.ItemType = tblCustDevices.Devicetype Where tblCustDevices.State = 1 And (tblCustDevices.LastSeen > GetDate() - 30 AND tblCustDevices.LastSeen < GetDate() - 60) Order By tblCustDevices.Displayname