Home > other >  How do I query data based on partial date in BigQuery?
How do I query data based on partial date in BigQuery?

Time:09-27

I wanna see data for the event_date of 2022-09-03, but I don't know how to get that data.

The data is stored like this: event_date: 2022-09-03 09:33:54.873010 UTC but I only want to query it by the day, not the full amount.

Example Data:

My Query is:

SELECT
event_date
FROM
  `my-data-source`
WHERE
 event_date = "2022-09-03"

CodePudding user response:

Maybe it can help you

SELECT LEFT('2022-09-03 09:33:54.873010 UTC', 10)

You can test here

CodePudding user response:

I think you can get parameters:

Where event_date > "2022-09-02" and "2022-09-04" < event_date

CodePudding user response:

select * from  `my-data-source`
where cast(event_date  as date)='2022-09-03'
  • Related