Quantcast
Channel: THWACK: Message List
Viewing all articles
Browse latest Browse all 21093

Division returns 0 in query

$
0
0

Using SWQL Studio I have written a query where I want to do division in the SELECT to give me a percentage, however instead it seems to always return 0.

 

The result of the query below from our test platform is:

wouldtrigger | total | add | percentage

15 | 151 | 166 | 0

 

I am confused as the + operation works as expected, it is just / that fails. This confirms the numbers are ok and can be used in arithmetic.

 

I am using SQWL Studio v3 with the installation: NPM 10.6

 

My query is:

SELECT wouldtrigger, total, (ABS(wouldtrigger)+ABS(total)) as add, (ABS(wouldtrigger)/ABS(total)) as percentage

FROM

(

    SELECT COUNT(DISTINCT N.NodeId) as wouldtrigger, (

        SELECT COUNT(DISTINCT N.NodeId) as total

        FROM Orion.Nodes N

        WHERE 

        (

          (Status = '1') AND

          (

           (Vendor = 'Windows') OR

           (Vendor = 'net-snmp')

          )

        )

    ) as total

    FROM Orion.Nodes N

    WHERE 

    (

      (Status = '1') AND

      (

       (Vendor = 'Windows') OR

       (Vendor = 'net-snmp')) AND

      (PercentMemoryUsed > 90)

    )

)


Viewing all articles
Browse latest Browse all 21093

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>