How to get previous version of the table in databricks sql dynamically

anilsampson
New Contributor III

hello,

 

im trying to get the previous version of a delta table using timestamp but databricks sql does not allow to use variables the only thing i can do is use TIMESTAMP AS OF CURRENT_DATE() -1 if i have refreshed the table today.

please let me know if anyone has a better option.

please note i am using databricks sql as this is the only allowed language on databricks dashboard.