Change Field in SQL problem

B

Bob V

I have replaced QryOverdue.Payable with tblAccountStatus.PaidAmount, buy now
my query has gone from the correct 25 records to 256 records
Please any help..........Bob
**OLD**
SELECT QryOverdue.Name, Max(tblAccountStatus.BillDate) AS LastDate,
QryOverdue.Payable, tblOwnerInfo_OwnerFirstName, tblOwnerInfo_OwnerLastName,
tblAccountStatus.OwnerID
FROM (((tblAccountStatus INNER JOIN tblOwnerInfo ON tblAccountStatus.OwnerID
= tblOwnerInfo_OwnerID) INNER JOIN QryOverdue ON tblOwnerInfo_OwnerID =
QryOverdue.OwnerID) INNER JOIN qPaidAmountForPayment ON QryOverdue.OwnerID =
qPaidAmountForPayment.OwnerID) INNER JOIN qTotalDueForPayment ON
qPaidAmountForPayment.OwnerID = qTotalDueForPayment.OwnerID
GROUP BY QryOverdue.Name, QryOverdue.Payable, tblOwnerInfo_OwnerFirstName,
tblOwnerInfo_OwnerLastName, tblAccountStatus.OwnerID
ORDER BY QryOverdue.Name;

**NEW**
SELECT QryOverdue.Name, Max(tblAccountStatus.BillDate) AS LastDate,
tblAccountStatus.PaidAmount, tblOwnerInfo_OwnerFirstName,
tblOwnerInfo_OwnerLastName, tblAccountStatus.OwnerID
FROM (tblAccountStatus INNER JOIN tblOwnerInfo ON tblAccountStatus.OwnerID =
tblOwnerInfo_OwnerID) INNER JOIN QryOverdue ON tblOwnerInfo_OwnerID =
QryOverdue.OwnerID
GROUP BY QryOverdue.Name, tblAccountStatus.PaidAmount,
tblOwnerInfo_OwnerFirstName, tblOwnerInfo_OwnerLastName,
tblAccountStatus.OwnerID
ORDER BY QryOverdue.Name;
 
B

Bob V

Got It :)...............Bob
SELECT QryOverdue.Name, Max(tblAccountStatus.BillDate) AS LastDate,
Last(tblAccountStatus.PaidAmount) AS LastOfPaidAmount,
tblOwnerInfo_OwnerFirstName, tblOwnerInfo_OwnerLastName,
tblAccountStatus.OwnerID
FROM (tblAccountStatus INNER JOIN tblOwnerInfo ON tblAccountStatus.OwnerID =
tblOwnerInfo_OwnerID) INNER JOIN QryOverdue ON tblOwnerInfo_OwnerID =
QryOverdue.OwnerID
GROUP BY QryOverdue.Name, tblOwnerInfo_OwnerFirstName,
tblOwnerInfo_OwnerLastName, tblAccountStatus.OwnerID
ORDER BY QryOverdue.Name;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top