Wrox Programmer Forums
|
Visual Studio 2005 For discussing Visual Studio 2005. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2005 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 August 23rd, 2007, 12:40 AM
Authorized User
 
Join Date: May 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Transpose Tables

Could you help for following tables :
I work on VS.Net for Foxpro Database:

TablePeople (5000 records)
peopleID
************
age
race

TableExam (5000 records)
examID
date
peopleID


TableQuestions (5000 records)
questionID
questionFieldname (QFN0001,QFN0002,QFN0003, ... ,QFN5000)


TableAnswers (25,000,000 records)
examID
questionID
answer



SQL Query Statement Needed!
Query the database to return fields from TablePeople and TableAnswers
(from 1 to 255 questionFieldnames)


Example Query and return data from:
ExamID,************,age,race,QFN0001,QFN0002,QFN0003,QFN000 5,QFN0007,QFN0011


use to join the tables and return the following
ExamID, ************, age, race, QuestionFieldName, AnswerID
100001,M,40,White,QFN0001,0
100001,M,40,White,QFN0002,5
100001,M,40,White,QFN0003,6
100001,M,40,White,QFN0005,3
100001,M,40,White,QFN0007,5
100001,M,40,White,QFN0011,4
100002,M,55,White,QFN0001,1
100002,M,55,White,QFN0002,4
100002,M,55,White,QFN0003,3
100002,M,55,White,QFN0004,4
100002,M,55,White,QFN0007,5
100002,M,55,White,QFN0011,6
etc
105000,M,48,White,QFN0001,5
105000,M,48,White,QFN0002,4
105000,M,48,White,QFN0003,6
105000,M,48,White,QFN0005,3
105000,M,48,White,QFN0007,4
105000,M,48,White,QFN0011,5



We would like the resulting table to look like the following:

ExamID,************,age,race,QFN0001,QFN0002,QFN0003,QFN000 5,QFN0007,QFN0011
100001,M,40,White,0,5,6,3,5,4
100002,M,55,White,1,4,3,4,5,6
etc
105000,M,48,White,5,4,6,3,4,5


Any suggestions appreciated.








Similar Threads
Thread Thread Starter Forum Replies Last Post
Transpose the data yogeshyl Excel VBA 2 September 15th, 2007 11:09 AM
How to Transpose this type data jaincafe Access 1 November 27th, 2006 05:58 AM
Help with transpose fegasa Excel VBA 3 April 7th, 2006 03:43 AM
Transpose Rows JpJoe Access 10 March 17th, 2005 08:15 AM
transfer and transpose sham Excel VBA 4 March 6th, 2005 12:13 PM





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