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
Microsoft SQL Server 2008

Avatar of undefined
Last Comment
Kyle Abrahams

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Kyle Abrahams

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy