;with cte as ( select id, fld1 from #MaxDate union all select id, fld2 from #MaxDate union all select id, fld3 from #MaxDate union all select id, fld4 from #MaxDate union all select id, fld5 from #MaxDate ) select id, max(fld1) from cte group by id
========================================== Cursors are useful if you don't know sql. SSIS can be used in a similar way. Beer is not cold and it isn't fizzy.
This query is giving the date of fld 2 where fld2 date is greater than fld 2 and not checking dates with fld 3,fld 4 and fld 5 where in fld 5 date is the max
========================================== Cursors are useful if you don't know sql. SSIS can be used in a similar way. Beer is not cold and it isn't fizzy.