Pivot Table Question

Results 1 to 3 of 3

Thread: Pivot Table Question

  1. #1
    Mike Preuett Guest

    Default Pivot Table Question

    I&#039;ve got a table with two columns:<BR><BR>question,answer<BR><BR>answer can be three different values. how can i display this as<BR><BR>question,answer1 count, answer2 count, answer3count.<BR><BR>I don&#039;t need to sum the answers or anything, just need the number of each answer per question. Thanks in advance.

  2. #2
    Join Date
    Dec 1969

    Default RE: Pivot Table Question

    Why don&#039;t you add some more fields e.g.<BR>question,answer1,answer2,answer3<BR>and then loop through rs and fill table..<BR><BR><BR>

  3. #3
    Mike Preuett Guest

    Default RE: Pivot Table Question

    Figured out how to do it...<BR>select question,<BR>Count(case when answer=&#039;2&#039; then question end) as Yes,<BR>Count(case when answer=&#039;0&#039; then question end) as No,<BR>Count(case when answer=&#039;99&#039; then question end) as NA,<BR>count(case when answer=&#039;999&#039; then question end) as Unknown,<BR>count(question) as total<BR>from auditresults<BR>group by question<BR>order by question

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts