Questions tagged [amazon-presto]

Use for questions about how to use Amazon Presto SQL query engine on Amazon EMR.

Filter by
Sorted by
Tagged with
1 vote
3 answers
26 views

Presto/Mysql join validation

I have 2 tables, and the CASE statement below should only evaluate to 1/true if the record with the same lead_id exists in both tables. Here I have 2 ways of achieving this but just want to verify if ...
user avatar
0 votes
0 answers
32 views

Rolling sum with a floor in Athena/Presto

In Athena, I want to calculate a rolling sum, over a window, that can't go below 0. For example, if summing up a column that has values (1, 2, -1, -2, -1, -2, 1, 2) I should get (1, 3, 2, 0, 0, 0, 1, ...
user avatar
1 vote
1 answer
57 views

(Athena/Presto) Window function (lag) is not reading the previous lag row

I have two tables, credit_memos and credit_memo_items and want to show each event individually and will thus do a insert (doing union in this case which is logically the same). I know the key for both ...
user avatar
0 votes
2 answers
38 views

PRESTO Left join using multiple operators

I have 2 tables, one listing all our customers and then a 2nd listing every clients list of creditors/obligations Firstly, I need to return all clients in t1 and then be able to determine if the ...
user avatar
1 vote
1 answer
42 views

Getting the row before a row with a certain value in SQL

I have a table like below where user actions are stored with a timestamp. My goal is to identify the action that happened before a specific action (named reference_action) and count the number of ...
user avatar
1 vote
1 answer
939 views

AWS Athena: syntax for grouping data for week ending on a Saturday

I'm having some issues with the Presto syntax in grouping data by separate weeks, ending on Saturdays. I have this field called "timestamp," and I've been using the the following to group by weeks. ...
user avatar
  • 11
1 vote
1 answer
180 views

SQL query - Do I need a full join to produce this combined result?

With two tables structured like this: Table1 Table2 ---------------- ---------------- id, time, x id, time, y, z 1 1 1 1 2 ...
user avatar
  • 13
1 vote
1 answer
165 views

How to query from the result of a changed column of a table in postgresql

I am working with Presto on Amazon Athena. I have a string time column in a table and now I want to change that time to date time type and then query data for selected dates. Is there a direct way to ...
user avatar
  • 131