我有一个表和5列,其中一些值类似于彼此的颜色。现在我想在html选择字段中获取这些列的所有数据。![在此处输入图像描述] [1]
SELECT CONCAT (chemical_entity_0, chemical_entity_1, chemical_entity_2, chemical_entity_3, chemical_entity_4, chemical_entity_5, chemical_entity_6, chemical_entity_7, chemical_entity_8, chemical_entity_9) AS chemical_entity
FROM msds
答案 0 :(得分:0)
如果您想要每列一行,请使用UNION: -
SELECT chemical_entity_1 AS chemical_entity
FROM msds
UNION ALL
SELECT chemical_entity_2 AS chemical_entity
FROM msds
UNION ALL
SELECT chemical_entity_3 AS chemical_entity
FROM msds
UNION ALL
SELECT chemical_entity_4 AS chemical_entity
FROM msds
UNION ALL
SELECT chemical_entity_5 AS chemical_entity
FROM msds
UNION ALL
SELECT chemical_entity_6 AS chemical_entity
FROM msds
UNION ALL
SELECT chemical_entity_7 AS chemical_entity
FROM msds
UNION ALL
SELECT chemical_entity_8 AS chemical_entity
FROM msds
UNION ALL
SELECT chemical_entity_9 AS chemical_entity
FROM msds