Skip to content
Advertisement

Left join matching between dates

I am trying to pair the date of a national holiday with time bucket boundaries. I would like to left join against buckets. So I can identify if a holiday falls within a certain time frame has_holiday.

With the following query, I receive a Query error:

Query error: LEFT OUTER JOIN cannot be used without a condition that is an equality of fields from both sides of the join. at [6:1]

What is the best way to approach this problem?

Table structure for external_landing.tbl_public_holidays_2020

Advertisement

Answer

Try below (BigQuery Standard SQL)

Meantime, I would suggest below version

This one will output all buckets with number of the holidays in them
If you want to exclude bucket with no holidays – just add below to the end

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement