I have this table which stores millions of rows of data. This data has a date that indicates when was the data entered. I store the data in NUMERIC
schemas with EPOCH UNIX
as the format. However, I wanted to convert them to human date (yyyy-mm-dd hh:mm:ss) and later sort them by date not queried date.
However, it took me so long to find a suitable way. Here's my attempt.
I used
SELECT CAST(DATE(timestamp) AS DATE) AS CURR_DT FROM dataset.table
but it gave me this error:No matching signature for function DATE for argument types: NUMERIC. Supported signatures: DATE(TIMESTAMP, [STRING]); DATE(DATETIME); DATE(INT64, INT64, INT64) at [1:13]
I used this method BigQuery: convert epoch to TIMESTAMP but still didn't fully understand
I'm a novice in coding so I hope you guys understand the situation. Thanks!