Link to home
Create AccountLog in
Avatar of MOQINFRA

asked on

Modify SQL query to get additional Column

We have a SQL query to fetch the Space Information on the disks from one of our views in the SCCM databases. This database has columns like disk_Size, Free_Space etc, however we dont have a column for Used Space in that view

there is colum fro FreeSpace and Size
I want to Create a SQL query with a Colum UsedSpace = Size - Free space

the Query is mentioned below that gives me Size and Free Space

Any help to modify this query  to fetch that detail

the Original Query providing FreeSpace and Size is given below.

SELECT Distinct SYS.Name,LDISK.DeviceID0, LDISK.Description0, LDISK.VolumeName0,
 LDISK.FreeSpace0 as [Free space (MB)],
 LDISK.FreeSpace0/1024 as [Free space (GB)],
 LDISK.Size0/1024 as [Total space (GB)],

 FROM v_FullCollectionMembership SYS
 join v_GS_LOGICAL_DISK LDISK on SYS.ResourceID = LDISK.ResourceID
 JOIN v_R_System RSYS ON SYS.ResourceID = RSYS.ResourceID
Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account