Do a select for each ADP#. This will give you the domain for a single problem. Then you need to (combinatorially) add the Payout amounts until you hit the desired value.
That's what I did manually to determine Member IDs 1, 3 and 8 total to the desired amount.
Comment on Re: Using Perl to update multiple Database Records but not all