AnsweredAssumed Answered

Export Columnar Data to Excel

Question asked by SethRedlus on Dec 27, 2016
Latest reply on Dec 29, 2016 by SethRedlus

Hopefully I can make sense of this request. I have a database with essentially 3 tables:

1) People

2) Questions

3) Answers

 

The people table stores information about people who use the system.

The Questions table is a list of questions to be asked of these people

The Answers table is columnar data responses to the questions.

 

For Example:

The Questions Table contains:

1. What is your favorite color

2. What is your favorite animal.

3. What is your favorite city.

 

The Answers table contains:

PeopleIDQuestionID
Answer
11Blue
12Dog
13New York
21Red
22Dog
23Minneapolis

 

What I'm looking to do is to export the data from the database (either CSV or Excel) so that my rows are the people, but I want to columns to be the answers to their questions, i.e.

RecordID
Question ID 1
Question ID 2
Question ID 3
1BlueDogNew York
2RedDogMinneapolis

 

My mind is a little fried lately, but I'm not sure how best to accomplish this. Since the answers table is columnar, it's possible to have a hole - like if someone doesn't answer Question 2, then the value would be blank. Anyone know a good way to output the data like this?

Outcomes