Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my query I have a select statement that looks as follows:

SELECT 
 CAST((mt.SampleTotal * 100) / (mt.PopulationTotal * 100.0) as numeric(7,2)) as 'Column %'


That statement returns .14 My user however wants to see the answer returned as 14 (a whole number).

Is there a quick fix for this?

What I have tried:

I had to create quite a few temp tables to get this far. Ideally this solution would be a modification to select statement. This is what I've tried so far.
Posted
Updated 26-Apr-16 6:17am

1 solution

Remove the multiplier at the bottom?
SQL
SELECT CAST((mt.SampleTotal * 100) / mt.PopulationTotal as numeric(7,0)) as 'Column %'
 
Share this answer
 
Comments
Member 11820531 26-Apr-16 12:20pm    
I could've swore that I tried that. Thanks for your solution!
OriginalGriff 26-Apr-16 12:31pm    
:laugh:
We all miss the obvious from time to time!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900