Hi,
I'm hoping someone can help me out here. I have a report which shows the hard disk size and free space for each drive in each server.
A requirement has come up where I need to see the total size and total free space for each server - in other words, grouping the drives together for each server to show a total.
Here's the current SQL query I use. Any help would be appreciated.
Thanks.
Select Top 1000000
dbo.tblComputers.Computername,
dbo.tblComputers.ComputerUnique,
dbo.tblComputers.Domain,
tblADComputers.Description As Description,
Web40OSName.Compimage As icon,
tblDiskdrives.Caption As [Drive Letter],
Cast(Round(tblDiskdrives.Size / 1024 / 1024 / 1024, 2) As float) As Size,
Cast(Round(tblDiskdrives.Freespace / 1024 / 1024 / 1024, 2) As float) As [Free Space],
Cast(Round(((tblDiskdrives.Freespace / tblDiskdrives.Size) * 100), 2) As float) As [Percent Free] From dbo.tblComputersystem
Inner Join dbo.tblComputers On
dbo.tblComputersystem.Computername = dbo.tblComputers.Computername
Inner Join dbo.web40ActiveComputers On
dbo.tblComputers.Computername = dbo.web40ActiveComputers.Computername
Inner Join Web40OSName On
Web40OSName.Computername = dbo.tblComputers.Computername
Inner Join tblOperatingsystem On
dbo.tblComputers.Computername = tblOperatingsystem.Computername
Inner Join tblDiskdrives On
dbo.tblComputers.Computername = tblDiskdrives.Computername
Inner Join tblADComputers On
dbo.tblComputers.Computername = tblADComputers.Computername
Where
dbo.tblComputersystem.Domainrole > 1 And tblDiskdrives.DriveType = 3
Order By Round((Round(tblDiskdrives.Freespace, 2) / Round(tblDiskdrives.Size, 2)) * 100, 2), dbo.tblComputers.Computer