查看以下查询(它不起作用因为模板.a.COLUMN_NAME不存在)。
SELECT a.COLUMN_NAME, a.COLUMN_COMMENT, (SELECT templates.a.COLUMN_NAME AS status FROM templates WHERE ID=5) FROM information_schema.COLUMNS AS a WHERE a.TABLE_NAME = 'templates' AND column_name LIKE 'rev%';
我想选择与从information_schema中选择的COLUMN_NAME(ID = 5)对应的列中的数据。这可能吗?也许我试图逆转呢?
我正在寻找这样的结果:
COLUMN_NAME COLUMN_COMMENT status
rev_body_easy Body text easy to read 2
rev_header_easy Header easy to read 1