我有一個名爲Absence Details的表,我想將連續日期分組。這裏,是數據SQL Server查詢分組順序日期
EID AbsenceType AbsenceStartDate AbsenceEndDate
769 Holiday 2012-06-25 00:00:00.000 2012-06-25 23:59:59.000
769 Holiday 2012-06-26 00:00:00.000 2012-06-26 23:59:59.000
769 Holiday 2012-09-03 00:00:00.000 2012-09-03 23:59:59.000
769 Holiday 2012-09-04 00:00:00.000 2012-09-04 23:59:59.000
769 Holiday 2012-09-05 00:00:00.000 2012-09-05 23:59:59.000
769 Holiday 2012-09-06 00:00:00.000 2012-09-06 23:59:59.000
769 Holiday 2012-09-07 00:00:00.000 2012-09-07 23:59:59.000
我試圖得到的結果是
EID AbsenceType AbsenceStartDate AbsenceEndDate
769 Holiday 2012-06-25 00:00:00.000 2012-06-26 23:59:59.000
769 Holiday 2012-09-03 00:00:00.000 2012-09-07 23:59:59.000
任何幫助深表感謝。
您忘記了從標題中刪除AbsenceType列或爲此列添加值。 – Vikdor
@ Vikdor - 這是真的,我忘了刪除缺席原因欄。感謝那。 – user1682461
@podiluska - 我還沒有開始寫任何查詢。只是尋找指針。 – user1682461