You understood me correctly, however the amount does matter, because it could be that they have other checks 'preissued' by the time we get the file from adp, that has the check numbers.

So the amounts are relevant, however, it will be the first ones I come to, as I don't upload a later file before an earlier one, so it could be that the amount will equal the FIRST 1 or more but not likely it would be the second and third and fourth but not the first...

So, what I need to do is something like this, I guess:
my $_startingAmount = sprintf('%.2f', $fileparts [$_checkAmt]); my @potids = (); my $sth = $dbh->prepare(qq{SELECT * FROM `pot` WHERE `adpid` = ? AND ` +status` = "preissue" ORDER BYE `potid`}); $sth->execute($fileparts[$_emp_id]); while(my $_pot = $sth->fetchrow_hashref()) { if(sprintf('%.2f', $_pot->{amount}) <= $_startingAmount) { push(@potids, $_pot->{potid}); $_startingAmount -= $_pot->{amount}; last if $_startingAmount == 0.00; } next; } $sth->finish(); ## Now go update all the potid records in a foreach statement in @poti +ds
I think I need to think that through, but it SHOULD work... but what if the payroll company messes up and he amounts do not match up... guess I could keep track of that in the while statement and if I never reach 0.00 set a flag for that record and don't update those records. Hmm, what do you think?

Thanks again for your input, BTW, the employee identifier is 'adpid' that is the record of the employee file primary key, unique to each employee (Currently we have just shy of 2,000 in that table).

thx,
Richard

In reply to Re^2: payroll, mysql and perl question by powerhouse
in thread payroll, mysql and perl question by powerhouse

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.