Skip to content

Tag: presto

Grab Latest Data Based on String

I have a table with Forecast, Budget, & Actuals. I need to grab the latest data based on the month which is prefixed in the d_period field (Ex: Jan, Feb, Mar, Apr, etc.). The query should always default to the latest month (no relation to current month – the upload varies so it could be 2 months ago…

Convert to string to ‘Proper’ casing

Is there a way to convert a string to ‘Proper’ casing? I’m using the Excel definition of ‘Proper’ which will format text such that the first letter of any word is capitalized and the remaining letters are lower case. Sample Inputs | Outputs I browsed the string function/operators…

Presto – How to convert a field with map to rows

I’m new to Presto SQL and I am stuck to a issue and I really need your help. I have a table with a field “Info”: I want to pull all order_id(s) and convert them as rows, the output may look like this: My query: I tried the query above but it can only returns the order_id as an array.

Presto SQL save query results in variable

I have a database that I am querying with athena. I am using subqueries to select a subset of the data like so can I save the query results of in a variable VAR so that we need not query it again and again and also to make query look cleaner? Answer There is no such concept as variable in