I am creating a view in BigQuery with the following SQL statement:
SELECT Id, CreatedDate FROM [bucketname.tablename]
How can I modify this query so that the CreatedDate
becomes rounded down to midnight in the view?
I believe you can just use the DATE
function:
Returns a human-readable string of a
TIMESTAMP
data type in the format%Y-%m-%d
.
So:
SELECT Id, DATE(CreatedDate) AS CreatedDate From [dataset.tablename]
See more on this question at Stackoverflow