here is a query I run
I then get the results run them thru a loop and run this query on every result of the previous query. $lnb is the loannumber selected in the above query.
I then display the results of the first query with the last five comments for that loan.
this works but is slow. I'm wondering if there is a way to combine the two queries? Not sure how I would do this because of the multiple records i need to display in the second query.
Thanks for any help with this
SELECT loaninfo.loannumber, loaninfo.b1_lastname, loaninfo.nextduedate, loaninfo.lastpaymentdate, achtransfer.paymentdate, achtransfer.total_amount, loaninfo.investornumber FROM loaninfo LEFT JOIN achtransfer ON loaninfo.loannumber=achtransfer.loannumber WHERE loaninfo.investornumber NOT IN ('001', '002', '003') AND loaninfo.totaldelinquent > '0' AND loaninfo.upb > '0'
I then get the results run them thru a loop and run this query on every result of the previous query. $lnb is the loannumber selected in the above query.
SELECT commentdate, comment FROM comments WHERE loannumber = '$lnb' ORDER BY commentdate DESC LIMIT 0, 5
I then display the results of the first query with the last five comments for that loan.
this works but is slow. I'm wondering if there is a way to combine the two queries? Not sure how I would do this because of the multiple records i need to display in the second query.
Thanks for any help with this