Hi,
This should get you started :
Select Top (1000000) Case
When DatePart(yyyy, tblAssetCustom.Warrantydate) Is Not Null Then
Concat(DatePart(yyyy, tblAssetCustom.Warrantydate) - DatePart(yyyy,
GetDate()), ' :Years Warranty Remaining')
End As Title,
Count(tblAssets.AssetName) As [Count Of Assets]
From tblAssetCustom
Inner Join tblAssets On tblAssetCustom.AssetID = tblAssets.AssetID
Inner Join tsysOS On tblAssets.OScode = tsysOS.OScode
Left Outer Join tsysIPLocations On tsysIPLocations.LocationID =
tblAssets.LocationID
Group By Case
When DatePart(yyyy, tblAssetCustom.Warrantydate) Is Not Null Then
Concat(DatePart(yyyy, tblAssetCustom.Warrantydate) - DatePart(yyyy,
GetDate()), ' :Years Warranty Remaining')
End
Order By [Count Of Assets]