cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post

SWQL Atrithmetic

Jump to solution

How does one do atirhmetic in SWQL?

I would like to see the total number of elements mananged on a node. I can run this query:

SELECT Count(Nodes.Volumes.VolumeID) AS Volumes,
       Count(Nodes.Interfaces.InterfaceID) AS Interfaces
FROM Orion.Nodes WHERE Caption = 'the node I am looking for'

But how to actually get a sum over both these values?

SELECT ( Count(Nodes.Volumes.VolumeID) AS a
         + Count(Nodes.Interfaces.InterfaceID) AS b ) AS Total
FROM Orion.Nodes WHERE Caption = 'the node I am looking for'

Yields: mismatched input 'AS' expecting ')' in Select clause 

Any Ideas?

Labels (2)
0 Kudos
1 Solution
Level 11

@nmsrabobank.nl 

You don't need the 'AS' if ypu are aggregating the totals.

SELECT ( Count(Nodes.Volumes.VolumeID) + Count(Nodes.Interfaces.InterfaceID) ) AS Total
FROM Orion.Nodes WHERE Caption = 'the node I am looking for'

 

 

View solution in original post

0 Kudos
1 Reply
Level 11

@nmsrabobank.nl 

You don't need the 'AS' if ypu are aggregating the totals.

SELECT ( Count(Nodes.Volumes.VolumeID) + Count(Nodes.Interfaces.InterfaceID) ) AS Total
FROM Orion.Nodes WHERE Caption = 'the node I am looking for'

 

 

View solution in original post

0 Kudos