Is there a way to return all the columns in a MySQL table in a string format?
I would like to have something like this returned:
course_id, name, par, yds, mtrs
etc.
I am aware of how to show the fields/columns in a table (SHOW FIELDS FROM course;
) however these are returned in a tabular format.
SELECT GROUP_CONCAT(COLUMN_NAME,',') FROM INFORMATION_SCHEMA.
COLUMNS
WHERE TABLE_NAME = 'tablename'If your DB-user has access to the information schema, you can use the following: