I have a database that I am querying with athena.
I am using subqueries to select a subset of the data like so
(select item , max(date) from (select * from tablename where x=y)
groupby 1 ) as p
LEFT JOIN
(select item ,date , max(date2) from (select * from tablename where x=y)
groupby 1,2 ) as q
ON p.item=q.item ;
can I save the query results of
select * from tablename where x=y
in a variable VAR so that we need not query it again and again and also to make query look cleaner?