Here is another SQL question about dates ...
I am creating a calendar application using PHP and Postgres that will display events spanning days, weeks, or possibly months. Each event has a start date and an end date, and selecting them by range is not a problem; however, it would be helpful if Postgres can share multi-week events on the first day of each week. I was told that this can be done with GROUP BYand EXTRACT, but I'm not good enough in SQL to figure out how to do this.
Question: can this be done, and what will be the exact request? I am currently using SELECT * FROM events WHERE (range) OVERLAPS (range); and then do splitting in PHP, but this is clearly not optimal.
source
share