All you are lacking is a coherent description of your requirements.
Originally posted by Justin Charpenter:
I want the 07D that has the oldest date and the highest seq # and highest transaction # but at 99 they start over with 1-2-3 again.
And what if there's an 07D that has the oldest date but not the highest seq #? What if the record with the oldest date and the highest seq # isn't an 07D? And what's that about starting with 1 again? Either it means you can't tell what the highest transaction # is, or it means nothing.
example I want the last transaction that has a 07D there are 10 transactions the 4th one is a 07d and the 10th is a 04Z I will get the 07d because there is a 07D in one of the top 10. But I only want it if it is the 10th one.
Does that mean you want the last record if it's an 07D, or else you want nothing?
Sorry, I'm confused and what you posted didn't help.
[ January 25, 2008: Message edited by: Paul Clapham ]