I have a table with answered questions that looks like that:
1 answer 1
1 answer 2
1 answer 3
1 answer 4
.
.
.
2 answer 1
2 answer 2
2 answer 3
2 answer 4
.
.
ect
and I want it to transform it to a table like this:
answers 1 answers 2 answers 3 answers 4 ...
1 | answer 1 | answer 2 | answer 3 | answer 4 | ...
2 | answer 1 | answer 2 | answer 3 | answer 4 | ...
.
.
note that I want the answers to be on different columns thus:
[code=mysql]
SELECT number_column
, GROUP_CONCAT( answer_column SEPARATOR ' ' ) answer_column
FROM your_table
GROUP BY number_column
ORDER BY number_column[/code]
isn't working for me beacuse I get all the answers connected as one string in one column
thanks!!!
rotem blumberg
1 answer 1
1 answer 2
1 answer 3
1 answer 4
.
.
.
2 answer 1
2 answer 2
2 answer 3
2 answer 4
.
.
ect
and I want it to transform it to a table like this:
answers 1 answers 2 answers 3 answers 4 ...
1 | answer 1 | answer 2 | answer 3 | answer 4 | ...
2 | answer 1 | answer 2 | answer 3 | answer 4 | ...
.
.
note that I want the answers to be on different columns thus:
[code=mysql]
SELECT number_column
, GROUP_CONCAT( answer_column SEPARATOR ' ' ) answer_column
FROM your_table
GROUP BY number_column
ORDER BY number_column[/code]
isn't working for me beacuse I get all the answers connected as one string in one column
thanks!!!
rotem blumberg
Comment