我正在使用以下脚本从information_schema.columns中提取数据
SELECT table_name,
column_name
FROM information_schema.columns
WHERE TABLE_NAME = 'member'
OR TABLE_NAME = 'site'
AND TABLE_SCHEMA = 'project'
ORDER BY TABLE_NAME
示例数据如下:
|table_name| column_name |
|----------|--------------|
|site | site_id |
|site | name |
|member | mid |
|member | name |
|member | phone1 |
|member | phone2 |
|member | sex |
|member | dob |
|member | age_yrs |
--------------------------
数据透视如下:
|site | member |
---------------------------
|site_id | mid |
|name | name |
| | phone1 |
| | phone2 |
| | sex |
| | dob |
| | age_yrs |
---------------------------