Nov 14, 2009 #1 IAMINFO MIS Feb 21, 2002 62 US Hello everyone I am not sure how to proceed. I would like to divide recidivism / releaseDate select count(*) from recidivism select count (*) from releaseDate Thank you for helping if you can.
Hello everyone I am not sure how to proceed. I would like to divide recidivism / releaseDate select count(*) from recidivism select count (*) from releaseDate Thank you for helping if you can.
Nov 14, 2009 #2 r937 Technical User Jun 30, 2002 8,847 CA Code: SELECT ( select count(*) from recidivism ) / ( select count (*) from releaseDate ) r937.com | rudy.ca Buy my new book Simply SQL from Amazon Upvote 0 Downvote
Code: SELECT ( select count(*) from recidivism ) / ( select count (*) from releaseDate ) r937.com | rudy.ca Buy my new book Simply SQL from Amazon
Nov 14, 2009 #3 markros Programmer May 21, 2007 3,150 US declare @Cnt1 int, @cnt2 int select @cnt1 = count(*) from recidivism select @cnt2 = count (*) from releaseDate select coalesce(cast(@cnt1/nullif(@cnt2,0) as decimal(19,4)),0) as FinalResult, @cnt1 as Count1, @cnt2 as Count2 Upvote 0 Downvote
declare @Cnt1 int, @cnt2 int select @cnt1 = count(*) from recidivism select @cnt2 = count (*) from releaseDate select coalesce(cast(@cnt1/nullif(@cnt2,0) as decimal(19,4)),0) as FinalResult, @cnt1 as Count1, @cnt2 as Count2
Nov 14, 2009 Thread starter #4 IAMINFO MIS Feb 21, 2002 62 US thanks for helping, i need to elaborate my count from recidivism is 43258 my count from released is 38422 I need to return the percentage 43258 is what percent of 38422 Thanks again Upvote 0 Downvote
thanks for helping, i need to elaborate my count from recidivism is 43258 my count from released is 38422 I need to return the percentage 43258 is what percent of 38422 Thanks again
Nov 15, 2009 #5 r937 Technical User Jun 30, 2002 8,847 CA Code: SELECT 100.0 * ( select count(*) from recidivism ) / ( select count(*) from releaseDate ) AS percent r937.com | rudy.ca Buy my new book Simply SQL from Amazon Upvote 0 Downvote
Code: SELECT 100.0 * ( select count(*) from recidivism ) / ( select count(*) from releaseDate ) AS percent r937.com | rudy.ca Buy my new book Simply SQL from Amazon
Nov 15, 2009 #6 markros Programmer May 21, 2007 3,150 US Multiple my code by 100.00 if you want to get percentage. Upvote 0 Downvote