Skip to content
Advertisement

Tag: amazon-athena

AWS Athena: Unsupported correlated subquery type but it works on Mysql and other flavors

For each order in orders table, I’m trying to return the latest order update value based on time_sent, grouped into a single row. The above select query works fine in MySql but not in AWS Athena. Working MySQL example below: https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=66f17cf9f3c8f19f758c7cb1381d8207 Is there a way to accomplish the above using joins? Answer It’s possible to achieve this with Window Functions

Need an SQL query that will left join with another table, which will in turn return the latest values based on time, grouped into a single row

I need help with a SELECT SQL query that will left join with another table on id column, which will in turn return the latest values based on time, grouped into a single row? Basically, join the two tables in such a way that for each record in users table that exists in time_series table, return the latest values based

SQL Data cleaning

I have a data set where I am trying to clean data. I want to remove the ** from email-address and phone_number and have just numbers in the phone_number column. how can i do it. Answer Here is one option using string functions: This removes ‘**’ from email, and all non-digit characters from phone_number.

Mapping two columns into one column in Athena

I have data in the Athena something like this: However, the table owner changed the provider to provider_new. Thus, after 2020-08-01 the provider returns to NULL. Here is my query: How can I map these two columns to one? Thanks in advance. Answer Do you want coalesce()? coalesce() returns the first non-null value of the arguments it is given.

Advertisement