Working out a percentage using sql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tonyshort
    New Member
    • Oct 2008
    • 1

    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
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    What's the table structure?

    -- CK

    Comment

    • joedeene
      Contributor
      • Jul 2008
      • 579

      #3
      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

      Comment

      Working...