次の表で、既に存在する開始日と終了日の間に開始日と終了日を入力したときに、ユーザーに制限したいと思います。
例: ユーザーは、開始日 2012 年 2 月 6 日と終了日 2012 年 4 月 6 日の日付を挿入しようとします。この日付は、下の表のイベント e2 の間にあるため、ユーザーは挿入できません。
------------------------------------------------------------------------
id event startdate enddate
------------------------------------------------------------------------
11 e1 31/5/2012 1/6/2012
12 e2 1/6/2012 4/6/2012
13 e3 5/6/2012 6/6/2012
14 e4 15/6/2012 16/6/2012
他のイベントと競合するイベントの数を見つけたいです。