Connecting Tech Pros Worldwide Help | Site Map

Working out a percentage using sql

 
LinkBack Thread Tools Search this Thread
  #1  
Old October 3rd, 2008, 06:37 PM
Newbie
 
Join Date: Oct 2008
Posts: 1
Default Working out a percentage using sql

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
Reply
  #2  
Old October 3rd, 2008, 06:40 PM
ck9663's Avatar
Expert
 
Join Date: Jun 2007
Posts: 1,809
Default

What's the table structure?

-- CK
Reply
  #3  
Old October 3rd, 2008, 11:28 PM
joedeene's Avatar
Site Addict
 
Join Date: Jul 2008
Location: US of A
Posts: 587
Default

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
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search


Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.