...
not sure if its worth it...but:Declare @t table ( id int identity(1,1) not null, d1 datetime, d2 datetime, d3 datetime, Primary Key(id))Insert Into @t Select '1/1/2011', '2/1/2011', '3/1/2011'Insert Into @t Select '1/1/2011', '4/1/2011', '3/1/2011'Insert Into @t Select '5/1/2011', '2/1/2011', '3/1/2011'Insert Into @t Select '1/1/2011', '2/1/2011', nullInsert Into @t Select null, '2/1/2011', nullInsert Into @t Select null, null, nullSelect A.*, B.LastDFrom @t ALeft Join ( Select id, LastD = max(d) From ( Select * From @t A Unpivot (d For d_Source In (d1, d2, d3)) B ) Z Group By id ) BOn A.id = B.id
Corey
I Has Returned!!