アクションのテーブルがあります。各アクションにはstartDateとendDateの2つの日付があります。日ごとにグループ化するリクエストを作成したいのですが、連続して作成します。
例:
action ; startDate ; endDate
Action1 ; 2012-10-10 ; 2012-10-10
Action2 ; 2012-10-10 ; 2012-10-12
Action3 ; 2012-10-14 ; 2012-10-15
私のリクエストは
SELECT DAY(startDate), COUNT(Name) FROM ActionTable
WHERE startDate < '2012-10-09' and endDate > '2012-10-15'
GROUP BY DAY(startDate)
このリクエストは私にそれを返します:
10 ; 2
14 ; 1
この結果を取得するにはリクエストが必要です
10 ; 2
11 ; 1
12 ; 1
14 ; 1
15 ; 1
したがって、アクションが3日以内にある場合、毎日+1を取得する必要があります