尝试在AWS Athena中执行以下操作。在我看来,这似乎是标准的SQL:
select
count(case when gender='Male' then 1 end) as male_count
count(case when gender='Female' then 1 end) as female_count,
count(case when gender is null then 1 end) as other_count,
count(*) as total_count
from onepercentsampleflattened_90days_parquet;
我收到以下错误:
line 3:3: mismatched input 'count' expecting {<eof>, ',', 'from', 'where', 'group', 'order', 'having', 'limit', 'union', 'except', 'intersect'} (service: amazonathena; status code: 400; error code: invalidrequestexception; request id: d7ccbaef-e5da-4fca-8ae8-60fb8b93ce6c)
感谢您的帮助。谢谢!
答案 0 :(得分:2)
您应该在第一次计数后添加逗号,也使用计数将为所有记录提供相同的计数,您应该使用 sum