In mysql, one can do this in order to compare 2 timestamp :
where UNIX_TIMESTAMP(transaction.closed_on)<UNIX_TIMESTAMP(transaction.opened_on)...
What’s the equivalent function for Google bigquery ?
In mysql, one can do this in order to compare 2 timestamp :
where UNIX_TIMESTAMP(transaction.closed_on)<UNIX_TIMESTAMP(transaction.opened_on)...
What’s the equivalent function for Google bigquery ?
... to subtract 2 timestamp : ...
you can use TIMESTAMP_DIFF(closed_on, opened_on, SECOND)
for BigQuery Standard SQL
to compare in WHERE clause
WHERE closed_on < opened_on
finally, to convert timestamp to unix time ...
Use UNIX_SECONDS() function
It is called UNIX_SECONDS
:
select UNIX_SECONDS(TIMESTAMP("2008-12-25 15:30:00")) - UNIX_SECONDS(TIMESTAMP("2008-11-25 15:30:00"))