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日」のレコードも返します。これは私が望むものではありません。startDateaとendDate=を持つレコードは必要ありませんmyDate
だから私は試しました:
Select *
From myDatabase
Where empId = 145
and myDate between startDate and endDate
and (myDate <> startDate AND myDate <> endDate)
これはすべての場合に機能しますか?