This is What'sUp Gold data. What version of SQL Server is hosting it?
The left joins in the query will be converted into inner joins by the child table joins:
INNER JOIN pivotdevicetogroup pdg
ON pdg.nDeviceID = d.nDeviceID
INNER JOIN DeviceGroup dg
ON pdg.nDeviceGroupID = dg.nDeviceGroupID
You don't want nsize in the GROUP BY, if you want to SUM it in the output.
Use column aliases throughout so folks can see what tables your columns belong to.
Try something like this:
SELECT
nDeviceID,
sDisplayName,
sgroupname,
sDescription,
dPollTime,
Minimaal_gebruik,
Maximaal_gebruik,
Totaal_Schijfruimte,
(SUM_nUsed_Min / Totaal_Schijfruimte) * 100.0 AS Ingebruik
FROM (
SELECT TOP 10
d.nDeviceID,
d.sDisplayName,
sgroupname,
sDescription,
dPollTime,
MIN(nUsed_Min)/1048576 AS Minimaal_gebruik,
MAX(nused_Max)/1048576 AS Maximaal_gebruik,
CAST(SUM(nSize)/1048576 AS DECIMAL(10,2)) AS Totaal_Schijfruimte,
SUM(nUsed_Min/1048576) AS SUM_nUsed_Min
FROM dbo.StatisticalDisk sd
LEFT JOIN dbo.StatisticalDiskIdentification sdi
ON sdi.nStatisticalDiskIdentificationID = sd.nStatisticalDiskIdentificationID
LEFT JOIN dbo.PivotStatisticalMonitorTypeToDevice pm
ON pm.nPivotStatisticalMonitorTypeToDeviceID = sdi.nPivotStatisticalMonitorTypeToDeviceID
LEFT JOIN Device d
ON d.nDeviceID = pm.nDeviceID
INNER JOIN pivotdevicetogroup pdg
ON pdg.nDeviceID = d.nDeviceID
INNER JOIN DeviceGroup dg
ON pdg.nDeviceGroupID = dg.nDeviceGroupID
INNER JOIN [time]
ON sd.dPollTime = [time].PK_Date
WHERE sd.dPollTime = dateadd(MM, 1, '2013')
AND dg.sGroupName IN ('CUSTOMER')
GROUP BY
d.nDeviceID,
d.sDisplayName,
dg.sgroupname,
sDescription,
dPollTime--,
--nSize
ORDER BY dPollTime DESC
) d
WHERE (SUM_nUsed_Min / Totaal_Schijfruimte) * 100.0 >= 80
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden