1. 程式人生 > >mysql查詢表所有列名,並用逗號分隔

mysql查詢表所有列名,並用逗號分隔

tab for ble group table sql查詢 mat columns col

SELECT GROUP_CONCAT(COLUMN_NAME SEPARATOR ",") FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = ‘db_name‘ AND TABLE_NAME = ‘table_name

修改紅色部分為自己數據庫的名字和表名字

mysql查詢表所有列名,並用逗號分隔