我有一个表tbl_2016,列col1和col2。我想求出col1中以元音开头的col2的和。我尝试了以下代码,但我担心Hive理解它以"AEIOU"开头,而不是"A"或"E"或"I"或"O"或"U":
select SUM(col1) as Total_col1 from tbl_2016 WHERE col2 LIKE "[AEIOU]%";
尝试使用RLIKE
匹配regex:
select SUM(col1) as Total_col1 from tbl_2016 WHERE col2 RLIKE '^[AEIOU]';