Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Help with SQL Round

$
0
0

I need to round up my Percentage column in my query below and couldnt quite get the ROUND function right. Right now I am getting:

28.888888800

would like

28.89%

SELECT
	  a.doctor as Doctor
	, a.financialclass AS FinancialClass
	, COUNT( a.PatientVisitId ) / CAST( sub.the_count AS DECIMAL( 8 , 2 )) *100 AS Percentage 
FROM
#temp a JOIN( 
		    SELECT
				 doctor
			    , COUNT( patientvisitid )AS the_count
		    FROM #temp
		    GROUP BY
				   doctor )sub ON a.doctor = sub.doctor
GROUP BY
	    a.doctor
	  , a.FinancialClass
	  , sub.the_count
ORDER BY
	    Doctor , FinancialClass;	


Viewing all articles
Browse latest Browse all 23857

Trending Articles