‎04-26-2012 01:35 AM
SELECT TOP 1000000 tblCustDevices.Displayname,
tblCustDevices.Serialnumber,
tblCustDevices.PurchaseDate,
tblCustDevices.Warrantydate AS [Battery Replacement Due],
CASE
WHEN tblCustDevices.Warrantydate < Getdate() + 90
AND tblCustDevices.Warrantydate > Getdate() THEN
'UPS Battery Due Soon'
WHEN tblCustDevices.Warrantydate < Getdate() THEN
'Replace-Replace-Replace'
WHEN tblCustDevices.Warrantydate > Getdate() THEN
'Battery-Current'
END AS [Battery Status],
tblCustDevices.Location
FROM tblCustDevices
WHERE tblCustDevices.Displayname LIKE '%1500%'
ORDER BY tblCustDevices.Displayname
Solved! Go to Solution.
‎04-26-2012 04:35 PM
Select Top 1000000 tblCustDevices.DeviceKey, tblCustDevices.Displayname As
[Device name], tblCustDevices.Serialnumber, tblCustDevices.PurchaseDate,
tblCustDevices.Warrantydate As [Battery Replacement Due], Case
When tblCustDevices.Warrantydate < GetDate() + 90 And
tblCustDevices.Warrantydate > GetDate() Then 'UPS Battery Due Soon'
When tblCustDevices.Warrantydate < GetDate() Then 'Replace-Replace-Replace'
When tblCustDevices.Warrantydate > GetDate() Then 'Battery-Current'
End As [Battery Status], tblCustDevices.Location
From tblCustDevices
Where tblCustDevices.Displayname Like '%1500%'
Order By tblCustDevices.Displayname
‎04-26-2012 04:38 PM
‎04-26-2012 04:35 PM
Select Top 1000000 tblCustDevices.DeviceKey, tblCustDevices.Displayname As
[Device name], tblCustDevices.Serialnumber, tblCustDevices.PurchaseDate,
tblCustDevices.Warrantydate As [Battery Replacement Due], Case
When tblCustDevices.Warrantydate < GetDate() + 90 And
tblCustDevices.Warrantydate > GetDate() Then 'UPS Battery Due Soon'
When tblCustDevices.Warrantydate < GetDate() Then 'Replace-Replace-Replace'
When tblCustDevices.Warrantydate > GetDate() Then 'Battery-Current'
End As [Battery Status], tblCustDevices.Location
From tblCustDevices
Where tblCustDevices.Displayname Like '%1500%'
Order By tblCustDevices.Displayname
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now