Skip to content
Advertisement

Join date to date range SQL

I have event on the calendar table as follows

And I have a table daily as follows

I would like to join these table to get the daily with the new column of event name base on specific country, for example: I will consider only US event. So the expected output should be the following table.

May I know how to do joining effectively in postgresql?

Advertisement

Answer

i would do it like this:

I recreated your tables (with slight differences in column-names) in a db-fiddle and so you can look up the query there.

Note that i am not an PostgreSQL expert, i just thought i maybe can help you with your problem. 🙂

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