Look like Dave beat me to it!
create table #temp_results
(id int,
[min] date,
[max] date)
GO
truncate table #temp_results
GO
declare
@id int,
@date smalldatetime,
@curr_id int,
@min_date smalldatetime,
@max_date smalldatetime,
@row_count int
declare a_cursor cursor for select
[date],[id]...