1

I want to filter my data as per the DATE and TIME format '2016-01-09 16:31:04.000 UTC' using Legacy SQL in BigQuery. Kindly help me out with the correct syntax. I'm stuck.

Code

SELECT *
FROM
[table.column] AS Alias
WHERE
date >  '2017-03-31Z'; 
akilesh raj
  • 656
  • 1
  • 8
  • 19
shakti nayan
  • 13
  • 1
  • 4

1 Answers1

5

If the type of your column is timestamp then,

SELECT timestamp
FROM [bigquery-public-data:openaq.global_air_quality]
where timestamp > '2018-01-01 00:00:00'

If the type of the column is `string, then you can try,

SELECT timestamp
FROM [bigquery-public-data:openaq.global_air_quality]
where timestamp(timestamp) > timestamp('2018-01-01 00:00:00')

For more BigQuery Legacy SQL functions go here

akilesh raj
  • 656
  • 1
  • 8
  • 19