• Hi

    Jeff,Gsquared

    Thanks for giving me the best suggestions that helped Gsquared to provide me the outstanding logic for my task. It was my first time posting and i was quite skeptical about it, i am amazed there are people like jeff and Gsquared who actually get into the problem , no matter how long and tedious it was! I am impressed. Gsquared , thanks a million

    For 'Gsquared'

    You have understand my requirment, so it raises my expectation that you could help me nail this down.

    your script and logic is outstanding and it was able to tag SetFirst and SetLast with 1. But the problem is that i

    I would like to update the temp table like this:

    Every time it sees different 'Prd' and different status id it should update accordingly

    id 1, if Prd =A, statusid=1, then update setfirst=1 and setlast=1

    id 2, if Prd=B, status id=1, then update setfirst=2 and setlast=1

    id 3, if Prd=B, statusid =2, then update setfirst=1 and setlast=1

    id 4, if Prd=B, statusid=2, then update setfirst=1 and setlast=2

    id 5, if Prd=A, statusid=1, then update setfirst=3 and setlast=1

    id 6, if Prd=A, statusid=2, then update setfirst=1 and setlast=3

    id 7, if Prd=B, statusid=1, then update setfirst=4 and setlast=1

    id 8, if Prd=B, statusid=2, then update setfirs=1 and setlast=4

    Basically i am trying to distinguish the each block of data which starts from one 'Prd' and statusid=1 and change to different 'Prd' and change to statusid=2 and might again change back to different 'Prd'

    and different status orderby id

    Business logic : i am trying to see how the case was open on Product Support centre when customer call for troubleshooting . First what 'Prd' name they open the case and as time goes by how the case was handled and how many time the 'Prd' name was changed and how many times it was open and closed under different 'Prd' name

    Here i have also attached the data on excel file, hope it might provide some insight

    Millions of Thanks Gsquared

    Thanks

    Simon