Max in a Query

  • Thread starter Thread starter Bob V
  • Start date Start date
B

Bob V

Trying to get just the 1 record of a OwnerID with the highest number in
there BillID1
Thanks for any Help....Bob
My Attempt :(
SELECT tblAccountStatus.PaidAmount, tblAccountStatus.OwnerID,
Max(tblAccountStatus.BillID1) AS MaxOfBillID1
FROM tblAccountStatus INNER JOIN tblOwnerInfo ON tblAccountStatus.OwnerID =
tblOwnerInfo.OwnerID
GROUP BY tblAccountStatus.PaidAmount, tblAccountStatus.OwnerID;
 
Thanks Rico
worked it out :) :)
SELECT rh.ownerID, rh.PaidAmount, rh.BillDate
FROM tblAccountStatus AS rh, [SELECT max(Billdate) as maxdate, OwnerID
FROM tblAccountStatus
GROUP BY OwnerID]. AS maxresults
WHERE rh.OwnerID = maxresults.OwnerID
AND rh.BillDate= maxresults.maxdate;
 

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

Back
Top