Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
|
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 6th, 2006, 04:54 PM
Registered User
 
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Combine multiple records onto one line

I have a table consisting of answers to survey questions. The survey has 5 questions. My fields are:
  surveyID -- Indicates survey #
  surQuesID -- Indicates which question is being answered
  surAnsID -- Indicates actual answer to question

Sample data looks like:
surveyID surQuesID SurAnsID
100 1 4
100 2 4
100 3 5
100 4 4
100 5 5
101 1 5
101 2 3
101 3 3
101 4 4
101 5 4
102 1 5
etc.

I would like to build a query that shows the results of each individual survey on one line. The output would look like;

Survey Q1 Q2 Q3 Q4 Q5
100 4 4 5 4 5
101 5 3 3 4 4
102 5.....

Suggestions welcomed.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Help: Need to combine multiple IF queries scotts SQL Server 2005 1 April 14th, 2008 07:54 PM
Combine Multiple Rows into One Row eusanpe SQL Language 3 November 13th, 2007 01:25 PM
Multiple line capture. ShawnShannon BOOK: Beginning Regular Expressions 1 October 24th, 2006 06:48 AM
multiple line chart in crystal report ganans BOOK: Professional Crystal Reports for VS.NET 1 September 25th, 2006 12:13 PM
Line Break in ntext or varchar records marian_h SQL Language 3 November 17th, 2005 05:34 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.