在MySql

时间:2015-11-10 23:05:31

标签: mysql

如果我有以下表格:

[table_1]
id
name
address
zip 

[table_2]
id
power_source
zip

我需要一个返回DISTINCT列名的查询:

id
name
address
power_source
zip

表的数量很多,但确切数量未知。我需要整个数据库的不同列名称。

1 个答案:

答案 0 :(得分:3)

information_schema对此类信息很有用......

SELECT DISTINCT `column_name` 
FROM `information_schema`.`columns` 
WHERE table_schema = "[my schema name]";
相关问题