0
SELECT  DataID.unique_id as unique_id, question.question_id  
FROM  DataID 
RIGHT JOIN bookend  
on DataID.user_id = bookend.user_id and DataID.client_id = bookend.client_id 
LEFT JOIN question  
on bookend.user_id = question.user_id   
where type = 'test';

I am getting this value

unique_id   question_id   answer_id
2333              23             1
2333              24             5
2333              25             10
321                23            2
321                24            6
321                25            7

But i need to display it as

unique_id     Q1       A1      Q2      A2       Q3    A3  
2333          23       1       24      5        25    10    
321           23       2       24      6        25    7

How Could i do this?

dafodil
  • 531
  • 15
  • 30
  • Possible duplicate of [MySQL pivot table](http://stackoverflow.com/questions/7674786/mysql-pivot-table) – vaso123 Oct 26 '16 at 12:08
  • How many question are there? If it's a limited amount and you know the numbers, use @karacsi_maci link . – sagi Oct 26 '16 at 12:22

0 Answers0