I have a table in a MySQL database that works as a course grade book. I have the table set up so that the columns are students names and the rows are the assignment name. The data that goes in is the grade.
However the problem that i am having is when i try to select a student (column named after a student), it only return the name of the column repeated. Here is the query:
SELECT 'Ryan Wans' FROM cachedb.stewart;
Where Ryan Wans is the student name and stewart is the name of the table. It returns the following:
+---------+
|Ryan Wans|
+---------+
|Ryan Wans|
|Ryan Wans|
|Ryan Wans|
|Ryan Wans|
+---------+
It Should Return:
+---------+
|Ryan Wans|
+---------+
|100 |
|87 |
|100 |
|96 |
+---------+
It returns 4 times because I have 4 assignments in the table. The numbers represent the grades. Any help is appreciated.
NOTE : I would also prefer to keep the student names as columns.