Connecting Tech Pros Worldwide Help | Site Map

Working out a percentage using sql

  #1  
Old October 3rd, 2008, 07:37 PM
Newbie
 
Join Date: Oct 2008
Posts: 1
I have a table that holds four questions and the values assigned to that question. The value can only be Yes or No.

The results will look something like this Q1) Y, Q2) N, Q3) Y, Q4) Y. How can I get my sql result to display 75%?

At the moment I can only get the count to say 3 Yes and 1 No.

Thank you in advance
  #2  
Old October 3rd, 2008, 07:40 PM
ck9663's Avatar
Expert
 
Join Date: Jun 2007
Posts: 1,914
Provided Answers: 1

re: Working out a percentage using sql


What's the table structure?

-- CK
  #3  
Old October 4th, 2008, 12:28 AM
joedeene's Avatar
Site Addict
 
Join Date: Jul 2008
Location: US of A
Posts: 587

re: Working out a percentage using sql


Quote:
Originally Posted by tonyshort
I have a table that holds four questions and the values assigned to that question. The value can only be Yes or No.

The results will look something like this Q1) Y, Q2) N, Q3) Y, Q4) Y. How can I get my sql result to display 75%?

At the moment I can only get the count to say 3 Yes and 1 No.

Thank you in advance
would simple math not work, how is the "3 Yes and 1 No" returned, if you can add the Y's and N's then do something like divide the returned Y's by the total(Y+N) ? because 3/4 would give you .75, 75%...

joedeene
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
variable in SQL statement Matt answers 14 July 19th, 2006 10:45 PM
Incorrect DateTime.Now when saved to SQL John J. Hughes II answers 4 November 17th, 2005 06:16 AM
ADO Stored procedure not working using C# TedL answers 1 November 15th, 2005 10:57 PM
SQL Server to Oracel David Fitzjarrell answers 1 July 20th, 2005 05:08 AM