troubleshooting Question

dividing integer numbers

Avatar of DJ Stone
DJ Stone asked on
Microsoft SQL Server
12 Comments1 Solution79 ViewsLast Modified:
I have three separate SQL queries and I'm trying to divide but my results =0.  It should = 100.

SQL1                                                                                                          SQL2
select sum(cast(measurement as int)) AS KPIValue                    select sum(AssetStatusHistory.DownTime) AS KPIValue
From WOTask                                                                                      From AssetStatusHistory  
inner join wo on wo.wopk=WOTask.wopk                                      LEFT JOIN Asset on Asset.AssetPk =
WHERE                                                                                                   AssetStatusHistory.AssetPK
Measurement NOT LIKE '%[^0-9]%'                                                   RESULT = 0
RESULT = 2130

So I subtract SQL 1 from SQL2 then divide by SQL1 *100 which should give me 100%


Any suggestions!
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros