Skip to content
Advertisement

Tag: group-by

Hive: group by calculated column

I need to execute query like select myUsualField, SOME_FUNCTION(myAnotherField) as myUnusualField from MYTABLE group by myUsualField, myUnusualField In Hive this query fails: it cannot find field …

How to group by month and year?

I have a table PURCHASE with a date column PURCHASEDATE which is in DATE format. I’m trying to get the purchases grouped by month and year. To do so, I try with: I have also tryied with GROUP BY EXTRACT(MONTH FROM PURCHASEDATE), EXTRACT(YEAR FROM PURCHASEDATE) but neither worked. I’m rusty with SQL querys :S. EDIT Table cloumns Thanks ahead! Answer

Calculate Median for each group in AWS Athena table

Below is the schema for the athena table I wish to calculate median for ‘parameter_value’ group by standard_lab_parameter_name & units. For this I followed link : https://docs.aws.amazon.com/redshift/latest/dg/r_MEDIAN.html But on running the query It throws error Any help? Or if some alternative query would be great Answer Athena is based on Presto 0.172 – you can see all supported functions in

Advertisement