cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
dmorris
Engaged Sweeper II
I'm having an issue trying to add a custom date range to the server patch report, have tried using custom tables and no luck it is a bit above my current skills and understanding of sql

heres the report being used any help greatly appreciated

Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetUnique,
tblAssets.Domain,
tsysOS.OSname,
tblAssets.Description,
tblComputersystem.Lastchanged,
tsysOS.Image As icon,
tblQuickFixEngineeringUni.HotFixID,
tblQuickFixEngineeringUni.Description As Description1,
tblQuickFixEngineering.InstalledOn,
tblQuickFixEngineering.AssetID As AssetID1,
tblQuickFixEngineeringUni.QFEID,
tblQuickFixEngineering.QFEID As QFEID1,
tblAssets1.IPAddress
From tblComputersystem
Inner Join tblAssets On tblComputersystem.AssetID = tblAssets.AssetID
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysOS On tblAssets.OScode = tsysOS.OScode
Inner Join tblQuickFixEngineering On tblAssets.AssetID =
tblQuickFixEngineering.AssetID
Inner Join tblQuickFixEngineeringUni On tblQuickFixEngineeringUni.QFEID =
tblQuickFixEngineering.QFEID
Inner Join tblAssets tblAssets1 On tblAssets1.AssetID =
tblComputersystem.AssetID And tblAssets1.AssetID = tblAssetCustom.AssetID
And tblAssets1.AssetID = tblQuickFixEngineering.AssetID
Where tblComputersystem.Domainrole > 1 And tblAssetCustom.State = 1
Order By tblAssets.AssetName
1 ACCEPTED SOLUTION
AZHockeyNut
Champion Sweeper III
depends on the date you are trying to check for but here is one where it should return the last changed between a range I think...
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetUnique,
tblAssets.Domain,
tsysOS.OSname,
tblAssets.Description,
tblComputersystem.Lastchanged,
tsysOS.Image As icon,
tblQuickFixEngineeringUni.HotFixID,
tblQuickFixEngineeringUni.Description As Description1,
tblQuickFixEngineering.InstalledOn,
tblQuickFixEngineering.AssetID As AssetID1,
tblQuickFixEngineeringUni.QFEID,
tblQuickFixEngineering.QFEID As QFEID1,
tblAssets1.IPAddress
From tblComputersystem
Inner Join tblAssets On tblComputersystem.AssetID = tblAssets.AssetID
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysOS On tblAssets.OScode = tsysOS.OScode
Inner Join tblQuickFixEngineering On tblAssets.AssetID =
tblQuickFixEngineering.AssetID
Inner Join tblQuickFixEngineeringUni On tblQuickFixEngineeringUni.QFEID =
tblQuickFixEngineering.QFEID
Inner Join tblAssets tblAssets1 On tblAssets1.AssetID =
tblComputersystem.AssetID And tblAssets1.AssetID = tblAssetCustom.AssetID
And tblAssets1.AssetID = tblQuickFixEngineering.AssetID
Where tblComputersystem.Domainrole > 1 And tblAssetCustom.State = 1 and

tblComputersystem.Lastchanged between '2016-07-26' and '2017-07-26'
Order By tblAssets.AssetName

View solution in original post

2 REPLIES 2
dmorris
Engaged Sweeper II
That is exactly what i needed thank you AZ 😃
AZHockeyNut
Champion Sweeper III
depends on the date you are trying to check for but here is one where it should return the last changed between a range I think...
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetUnique,
tblAssets.Domain,
tsysOS.OSname,
tblAssets.Description,
tblComputersystem.Lastchanged,
tsysOS.Image As icon,
tblQuickFixEngineeringUni.HotFixID,
tblQuickFixEngineeringUni.Description As Description1,
tblQuickFixEngineering.InstalledOn,
tblQuickFixEngineering.AssetID As AssetID1,
tblQuickFixEngineeringUni.QFEID,
tblQuickFixEngineering.QFEID As QFEID1,
tblAssets1.IPAddress
From tblComputersystem
Inner Join tblAssets On tblComputersystem.AssetID = tblAssets.AssetID
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysOS On tblAssets.OScode = tsysOS.OScode
Inner Join tblQuickFixEngineering On tblAssets.AssetID =
tblQuickFixEngineering.AssetID
Inner Join tblQuickFixEngineeringUni On tblQuickFixEngineeringUni.QFEID =
tblQuickFixEngineering.QFEID
Inner Join tblAssets tblAssets1 On tblAssets1.AssetID =
tblComputersystem.AssetID And tblAssets1.AssetID = tblAssetCustom.AssetID
And tblAssets1.AssetID = tblQuickFixEngineering.AssetID
Where tblComputersystem.Domainrole > 1 And tblAssetCustom.State = 1 and

tblComputersystem.Lastchanged between '2016-07-26' and '2017-07-26'
Order By tblAssets.AssetName