【发布时间】:2020-02-14 20:36:25
【问题描述】:
我有下表my_table,其中两列都是字符串-
+------------+-------------+
| user_id| code |
+------------+-------------+
| ABC123| yyy,123,333|
| John| xxx,USA,555|
| qwerty| 55A,AUS,666|
| Thomas| zzz,666,678|
+------------+-------------+
我需要获取在其code 列值中具有yyy 或666 的所有user_id。我已经在在线 MySQL 模拟上测试了以下查询,它工作正常,但它在 AWS Athena 中不起作用-
SELECT user_id FROM my_table WHERE CONCAT(",", code, ",") REGEXP ",(yyy|666),";
结果应该是-
+------------+
| user_id|
+------------+
| ABC123|
| qwerty|
| Thomas|
+------------+
【问题讨论】:
标签: regex amazon-web-services concat presto amazon-athena