‎01-28-2016 02:40 PM
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssetCustom.State,
tblAssetCustom.Warrantydate,
tblAssetComments.Comment,
tblAssetComments.Added,
tblAssetComments.AddedBy,
tblAssetComments.CommentID
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblAssetComments On tblAssets.AssetID = tblAssetComments.AssetID
Where tblAssetCustom.State = 13
Order By tblAssetComments.CommentID Desc
Solved! Go to Solution.
‎01-30-2016 03:10 PM
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssetCustom.State,
tblAssetCustom.Warrantydate,
tblAssetComments.Comment,
tblAssetComments.AddedBy,
tblAssetComments.Added
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblAssetComments On tblAssets.AssetID = tblAssetComments.AssetID
Inner Join (Select tblAssetComments.AssetID,
Max(tblAssetComments.Added) As Max
From tblAssetComments
Group By tblAssetComments.AssetID) SubQuery On SubQuery.AssetID =
tblAssetComments.AssetID And SubQuery.Max = tblAssetComments.Added
Where tblAssetCustom.State = 13 And tblAssetComments.Added < GetDate() - 14
Order By tblAssetComments.Added
‎01-30-2016 03:10 PM
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssetCustom.State,
tblAssetCustom.Warrantydate,
tblAssetComments.Comment,
tblAssetComments.AddedBy,
tblAssetComments.Added
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblAssetComments On tblAssets.AssetID = tblAssetComments.AssetID
Inner Join (Select tblAssetComments.AssetID,
Max(tblAssetComments.Added) As Max
From tblAssetComments
Group By tblAssetComments.AssetID) SubQuery On SubQuery.AssetID =
tblAssetComments.AssetID And SubQuery.Max = tblAssetComments.Added
Where tblAssetCustom.State = 13 And tblAssetComments.Added < GetDate() - 14
Order By tblAssetComments.Added
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now