Get columns from query

Is it possible to get a list of columns from a query?

I have a table:-
SQL Table
But I want it to display the contents as:-
I know I could use a query such as:-
Select DISTINCT `question` FROM `myTable` WHERE `surveyID` = 1; 

Open in new window

Then build up the SQL statement to display my table.

I was going to use SQLite but think its not powerful enough to do this, so was thinking of using MySQL.

Any ideas if this is even possible, and if possible how can I do it?

Thank you
Who is Participating?
Tomas Helgi JohannssonCommented:

You could use some sort of pivot query here.
Look at this example
and here

     Tomas Helgi
tonelm54Author Commented:
Need to put it in a query from a database, not as a pivot table
Tomas Helgi JohannssonCommented:

If you look at the examples then you will see how this pivot query (executed inside the database)
transforms your data in pivot like manner into the format you are asking for.

   Tomas Helgi
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.