Hi,
I've got a procedure which basically calls a group by SQL:
[
select Claim_Ref,max(s1seq) as Last from V_Stam_clm group by claim_ref order by claim_ref asc]
and then with the results I go through all datasets and delete certain datasets depending on their value:
[delete from stam_clm where claim_ref = @Claim_Ref and s1seq <> @Last;]
This takes for ever, well 4.5 hours, due to the number of datasets..I was wondering if there was a better solution in general.
Thanks in advance