# Calculate occupancy of two stgpools in TSM

#### combato

Hi Pro's

Is it possible to calculate the occupancy from two stgpools in TSM and get the total amount? I Have two stgpools that I want to add and get a result?

SELECT stgpool_name,CAST(FLOAT(SUM(logical_mb))/1024/1024 AS DEC(8,2)) as TB FROM occupancy where stgpool_name='NDMPPOOL' GROUP BY stgpool_name
+
SELECT stgpool_name,CAST(FLOAT(SUM(logical_mb))/1024/1024 AS DEC(8,2)) as TB FROM occupancy where stgpool_name='FILERPOOL' GROUP BY stgpool_name

Regards,

/C

#### marclant

You are so close. Just need to change your where clause to be one pool or the other pool.
SQL:
``... where stgpool_name='NDMPPOOL' or stgpool_name='FILERPOOL' GROUP...``

#### marclant

Actually, that won't give you a grand total, just how much is in each pool. To get the sum of both pools, you would need:
SQL:
``````SELECT CAST(FLOAT(SUM(logical_mb))/1024/1024 AS DEC(8,2)) as TB -
FROM occupancy -
WHERE stgpool_name='NDMPPOOL' OR stgpool_name='FILERPOOL'``````

#### combato

Actually, that won't give you a grand total, just how much is in each pool. To get the sum of both pools, you would need:
SQL:
``````SELECT CAST(FLOAT(SUM(logical_mb))/1024/1024 AS DEC(8,2)) as TB -
FROM occupancy -
WHERE stgpool_name='NDMPPOOL' OR stgpool_name='FILERPOOL'``````
Great!! Thank you @marclant

/C

### UpCloud high performance VPS at \$5/month

Get started with \$25 in credits on Cloud Servers. You must use link below to receive the credit. Use the promo to get upto 5 month of FREE Linux VPS.