Link to home
Start Free TrialLog in
Avatar of MOQINFRA
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
ASKER CERTIFIED SOLUTION
Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial