Hello All,
I have next to no experience with SQL and I'm in my first IT role. As I'm training one of my tasks has been to monitor the shared folders we have on the network and keep tabs on thier sizes. So far I've got this:
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetUnique,
tblAssets.Domain,
tblSharesUni.Name,
tblShares.Lastchanged,
tblDiskdrives.Size,
tblDiskdrives.Freespace,
tblDiskdrives.Size - tblDiskdrives.Freespace As UsedSpace,
tblDiskdrives.Freespace / tblDiskdrives.Size * 100 As PercentageUsed
From tblShares
Inner Join tblAssets On tblShares.AssetID = tblAssets.AssetID
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysOS On tblAssets.OScode = tsysOS.OScode
Inner Join tblSharesUni On tblShares.ShareUniqueID =
tblSharesUni.ShareUniqueID
Inner Join tblDiskdrives On tblAssets.AssetID = tblDiskdrives.AssetID
Where tblDiskdrives.Size > 0 And tblAssetCustom.State = 1 And
tblSharesUni.Type = 0
Order By tblAssets.AssetName
But it duplicates the Shared drives and I'm slightly unsure of how to reduce the percentages down to 2 decimal places, I've tried ROUND and CONVERT but couldn't quite make it work. So any advice on how I get it just to display the share once and how to reduce it so 2 decimal places would be great!
Thanks in advance