我有一个具有以下结构的表:
+-----+------------+------------+------------+------------+
| ID | FEATURE1 | FEATURE2 | FEATURE3 | FEATURE4 |
+-----+------------+------------+------------+------------+
| 1 | red | blue | black | grey |
| 2 | yellow | | | |
| 3 | orange | red | green | golden |
| 4 | orange | grey | blue | |
我想做的是查询表并返回所有可能的功能以在自动完成调用中使用。我需要查询只返回唯一值。
SELECT (FEATURE1, FEATURE2, FEATURE3, FEATURE4, FEATURE5) FEATURE
FROM products
WHERE `FEATURE` LIKE 'gr%\'
我想要的输出是:
+----------+
| FEATURE |
+----------+
| green |
| grey |