F
F
Fyodor2015-12-15 07:51:15
MySQL
Fyodor, 2015-12-15 07:51:15

How, when querying three tables, to conclude where the values ​​of the second table are the names of the columns?

The essence of this
is there are three tables - a list of clients, a list of questions, answers are
stored something like this
{clients}
id, name
{questions}
id, question
{answers}
clientid, answerid,questionid,answer
Here I want to draw a conclusion so that it looks like this
[id client], [client name], [question 1], [question 2], [question 3], ...
[1],[Andrew],[answer 1],[answer 2],[answer 3],. ..
I'm breaking my head how to do it using mysql and it's easy. an option comes to mind, but a head-on option and a long and difficult to modify later, tk. The list and order of questions may change...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Afatar, 2015-12-15
@Afatar

I don't see any connection between question and answer. You need to add more questions id to the answer table.
The request will be like this
The output will be like this

1 Андрей Вопрос1 Ответ 1
1 Андрей Вопрос1 Ответ 2
1 Андрей Вопрос1 Ответ 3

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question