From: | "Greg Sabino Mullane" <greg(at)turnstep(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Checking for schedule conflicts |
Date: | 2005-03-15 01:41:19 |
Message-ID: | 1d37311813ee9c34476c1eae8e72388b@biglumber.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)turnstep(dot)com
PGP Key: 0x14964AC8 200503140639
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----
iD8DBQFCNXgTvJuQZxSWSsgRAlBmAKC7hj8XzHzS7srqfgdSGOZiCfvtDQCfWM22
VXMkQB7IzEdTKjqpcmWVdaM=
=hFiy
-----END PGP SIGNATURE-----
From | Date | Subject | |
---|---|---|---|
Next Message | Jack Orenstein | 2005-03-15 02:37:09 | Re: Logging VACUUM activity |
Previous Message | Ragnar Hafstað | 2005-03-15 00:25:22 | Re: Problem with special character � |