MySQL查询表的所有列名,用逗号拼接
问题场景
在MySQL中,需要以逗号拼接一个表的所有字段
sql语句
SELECT GROUP_CONCAT(COLUMN_NAME SEPARATOR ",") FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = 'db_name' AND TABLE_NAME = 'table_name'
转自:http://blog.csdn.net/sand_clock/article/details/74533605