Thread: Query Help

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0

    Query Help


    Help!

    Im trying to write a query that will pull quiz reults from a table. I need to have the participants # (id_pax), and then I wanted to have the questions across the top (each in its own column) and the anwser below.

    Currently the table I am pulling from holds all quiz results and each question/anwser is its own unique line. The quiz has 6 questions total so each particpant has 6 lines but I want to pull the reults as one line her participants where their anwsers to each question.

    Help please
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Mar 2008
    Posts
    1,928
    Rep Power
    378
    I think you're confusing issues of data display (normally managed at the application level - e.g. with a bit of PHP) with those of storage and retrieval (managed at the SQL end).

    See normalization.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0
    I do not have access to change the database. The table is current pax_id, quistion_nbr, anwser. So there are 6 results for each particpant (id_pax). Can I write a query to pull the results so that it only lists the id_pax once with each question/anwser?

    Originally Posted by cafelatte
    I think you're confusing issues of data display (normally managed at the application level - e.g. with a bit of PHP) with those of storage and retrieval (managed at the SQL end).

    See normalization.
  6. #4
  7. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,204
    Rep Power
    4279
    Originally Posted by Jam_ica
    Can I write a query to pull the results so that it only lists the id_pax once with each question/anwser?
    no, you would do that in php

    that comment about normalization doesn't apply to you
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

IMN logo majestic logo threadwatch logo seochat tools logo