Re: Checking for schedule conflicts
| От | Greg Sabino Mullane |
|---|---|
| Тема | Re: Checking for schedule conflicts |
| Дата | |
| Msg-id | 1d37311813ee9c34476c1eae8e72388b@biglumber.com обсуждение исходный текст |
| Ответ на | Checking for schedule conflicts (Benjamin Smith <lists@benjamindsmith.com>) |
| Список | pgsql-general |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Benjamin Smith wrote: > Given the tables defined below, what's the easiest way to check for schedule > conflicts? Assuming you don't count more than once things with the same id, start, and finish: SELECT COUNT(DISTINCT (s1.event_id||s1.start||s1.finish)) FROM sched s1, sched s2 WHERE s1.date = s2.date AND s1.start >= s2.start AND s2.finish <= s2.finish AND NOT s1.ctid = s2.ctid Add "AND s1.date = $date" as needed. - -- Greg Sabino Mullane greg@turnstep.com PGP Key: 0x14964AC8 200503140639 http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 -----BEGIN PGP SIGNATURE----- iD8DBQFCNXgTvJuQZxSWSsgRAlBmAKC7hj8XzHzS7srqfgdSGOZiCfvtDQCfWM22 VXMkQB7IzEdTKjqpcmWVdaM= =hFiy -----END PGP SIGNATURE-----
В списке pgsql-general по дате отправления: