‎12-14-2015 10:36 PM
Solved! Go to Solution.
‎12-14-2015 11:52 PM
SELECT Top 1000000
CASE
WHEN Left(tblSoftwareUni.softwareName, 6) = 'Java 7' THEN 'Java 7'
WHEN Left(tblSoftwareUni.softwareName, 6) = 'Java 8' THEN 'Java 8'
WHEN Left(tblSoftwareUni.softwareName, 10) = 'Java(TM) 6' THEN 'Java 6'
ELSE tblSoftwareUni.softwareName
END As Software,
Count(tblSoftware.AssetID) As Total
FROM
tblSoftware
Inner Join tblAssets On tblSoftware.AssetID = tblAssets.AssetID
Inner Join tblSoftwareUni On tblSoftware.softID = tblSoftwareUni.SoftID
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
WHERE
tblAssetCustom.State = 1
GROUP BY
CASE
WHEN Left(tblSoftwareUni.softwareName, 6) = 'Java 7' THEN 'Java 7'
WHEN Left(tblSoftwareUni.softwareName, 6) = 'Java 8' THEN 'Java 8'
WHEN Left(tblSoftwareUni.softwareName, 10) = 'Java(TM) 6' THEN 'Java 6'
ELSE tblSoftwareUni.softwareName
END
ORDER BY
Count(tblSoftware.AssetID) Desc
CASEdoes the substitutions for Java 6, 7 and 8 while the ELSE passes anything else through.
WHEN Left(tblSoftwareUni.softwareName, 6) = 'Java 7' THEN 'Java 7'
WHEN Left(tblSoftwareUni.softwareName, 6) = 'Java 8' THEN 'Java 8'
WHEN Left(tblSoftwareUni.softwareName, 10) = 'Java(TM) 6' THEN 'Java 6'
ELSE tblSoftwareUni.softwareName
END
‎12-18-2015 12:47 PM
‎12-16-2015 09:37 PM
‎12-14-2015 11:52 PM
SELECT Top 1000000
CASE
WHEN Left(tblSoftwareUni.softwareName, 6) = 'Java 7' THEN 'Java 7'
WHEN Left(tblSoftwareUni.softwareName, 6) = 'Java 8' THEN 'Java 8'
WHEN Left(tblSoftwareUni.softwareName, 10) = 'Java(TM) 6' THEN 'Java 6'
ELSE tblSoftwareUni.softwareName
END As Software,
Count(tblSoftware.AssetID) As Total
FROM
tblSoftware
Inner Join tblAssets On tblSoftware.AssetID = tblAssets.AssetID
Inner Join tblSoftwareUni On tblSoftware.softID = tblSoftwareUni.SoftID
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
WHERE
tblAssetCustom.State = 1
GROUP BY
CASE
WHEN Left(tblSoftwareUni.softwareName, 6) = 'Java 7' THEN 'Java 7'
WHEN Left(tblSoftwareUni.softwareName, 6) = 'Java 8' THEN 'Java 8'
WHEN Left(tblSoftwareUni.softwareName, 10) = 'Java(TM) 6' THEN 'Java 6'
ELSE tblSoftwareUni.softwareName
END
ORDER BY
Count(tblSoftware.AssetID) Desc
CASEdoes the substitutions for Java 6, 7 and 8 while the ELSE passes anything else through.
WHEN Left(tblSoftwareUni.softwareName, 6) = 'Java 7' THEN 'Java 7'
WHEN Left(tblSoftwareUni.softwareName, 6) = 'Java 8' THEN 'Java 8'
WHEN Left(tblSoftwareUni.softwareName, 10) = 'Java(TM) 6' THEN 'Java 6'
ELSE tblSoftwareUni.softwareName
END
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now