Joined: 23 Nov 2006 Posts: 13541 Location: 221 B Baker St
Hello,
What you want is not clear.
One good way to post this type of requirement is to show some sample input data. Show the exact output you want from that input. Use the cod tag and the Preview button to ensure your post will appear to the forum as you want it to appear.
Clearly explain the "rules" of the process to get from the input to the output.