... 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.

In other words, between the time that a set of rows goes out for check processing, and the time when the check-processing results come back to you for updating the table, there might be additional "preissue" rows that have been inserted for a given "empID". Is that it?

In that case, you are missing a piece of information, which might be simple to add in the current table structure: the date when a given set of rows were sent out for check processing (i.e. when the status field was set to "preissue"). You appear to have a "statuschanged" field, which apparently holds a date value.

If that field is set when the status field becomes "preissue", and if a set of check-processing results can be associated with that date, then you can select "preissue" rows with "statuschanged" less-than-or-equal-to the particular date, and you should get the right set of rows (excluding the rows that were added after the current list of payments were sent out for processing).

Your alternative of looping over records until you reach the payment amount would most likely solve it as well, but seems like more work. (And you would have to fix the spelling: "ORDER BY" -- no final "E")


In reply to Re^3: payroll, mysql and perl question by graff
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.