0
votes

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'; 
1
Try to provide example code snippets, show your code. - Dawid Rutkowski
SELECT * FROM [table_name] where date BETWEEN '2016-01-09 16:31:04.000 UTC' AND - shakti nayan
Simply update your question instead of putting the code in comments. - Dawid Rutkowski

1 Answers

3
votes

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