myDate
と'endDate'の間にあるすべてのレコードを取得しようとしていますstartDate
が、まったく同じ日付のレコードを返しません。私はMSSQL2005を使用しています。
私が試してみました:
Select *
From myDatabase
Where empId = 145
and myDate between startDate and endDate
ただし、myDateが「2011年11月16日」の場合、上記のクエリはastartDate
とendDate
=「2011年11月16日」のレコードも返します。これは私が望むものではありません。startDate
aとendDate
=を持つレコードは必要ありませんmyDate
だから私は試しました:
Select *
From myDatabase
Where empId = 145
and myDate between startDate and endDate
and (myDate <> startDate AND myDate <> endDate)
これはすべての場合に機能しますか?