starclassic
Technical User
Hello everyone,
How do I query only the max date to show up on the database with 2 or more contacts.
I have this query but it will show all record regardless of the follow update. I only need to show the up to date follow up date not the previous date. Any help will do.
I try the Max(FollowUpdate) but getting aggregate error.
Thanks
SELECT tblContact.MessageType, tblContact.FollowUpDate, tblCollectionsData.ContactMain, tblCollectionsData.AFOCode, tblCollectionsData.AgentCode, tblCollectionsData.AgentName, tblCollectionsData.PremCancelDate, tblCollectionsData.CancelDate, tblCollectionsData.PolicyEffectiveDate, tblCollectionsData.PolicyTerm, tblCollectionsData.ProRateDays, tblCollectionsData.ProRate, tblCollectionsData.Premium, tblCollectionsData.ProRateAmount, tblCollectionsData.TransAmount, tblCollectionsData.SystemCalculateAmountOwing, tblCollectionsData.LName, tblCollectionsData.Address, tblCollectionsData.Address1, tblCollectionsData.Address2, tblCollectionsData.Address3, tblCollectionsData.City, tblCollectionsData.Province, tblCollectionsData.PostalCode, tblCollectionsData.HomeNumber, tblCollectionsData.BusinessNumber, tblCollectionsData.Year, tblCollectionsData.Make, tblCollectionsData.Model, tblCollectionsData.Style, tblCollectionsData.Vin, tblCollectionsData.Class, tblCollectionsData.PolicyType, tblCollectionsData.FName, tblCollectionsData.DateUpLoad, tblCollectionsData.PremCancelDate1, tblCollectionsData.Overdue, tblCollectionsData.Closed, tblCollectionsData.CellNumber, tblContact.ContactID, tblContact.Contact, tblContact.ByLetter, tblContact.ccAgent, tblContact.EmployeeAlias, tblContact.ByPhone, tblContact.LeftMessage, tblContact.Promise, tblContact.Other, tblContact.OtherExplain, tblContact.GComments, tblContact.PolicyNumber, tblContact.Message, tblContact.MessageType, tblContact.ContactNumber
FROM tblCollectionsData RIGHT JOIN tblContact ON tblCollectionsData.PolicyNumber = tblContact.PolicyNumber
WHERE (((tblContact.FollowUpDate) Between [Forms]![frmQueue]![txtMoreThanTwo] And [Forms]![frmQueue]![txtMoreThanTwoEnd]) AND ((tblCollectionsData.ContactMain)>="3") AND ((tblCollectionsData.Closed)=0) AND ((tblContact.ContactNumber)="3"))
ORDER BY tblCollectionsData.LName, tblContact.ContactID DESC , tblContact.ContactNumber DESC;
How do I query only the max date to show up on the database with 2 or more contacts.
I have this query but it will show all record regardless of the follow update. I only need to show the up to date follow up date not the previous date. Any help will do.
I try the Max(FollowUpdate) but getting aggregate error.
Thanks
SELECT tblContact.MessageType, tblContact.FollowUpDate, tblCollectionsData.ContactMain, tblCollectionsData.AFOCode, tblCollectionsData.AgentCode, tblCollectionsData.AgentName, tblCollectionsData.PremCancelDate, tblCollectionsData.CancelDate, tblCollectionsData.PolicyEffectiveDate, tblCollectionsData.PolicyTerm, tblCollectionsData.ProRateDays, tblCollectionsData.ProRate, tblCollectionsData.Premium, tblCollectionsData.ProRateAmount, tblCollectionsData.TransAmount, tblCollectionsData.SystemCalculateAmountOwing, tblCollectionsData.LName, tblCollectionsData.Address, tblCollectionsData.Address1, tblCollectionsData.Address2, tblCollectionsData.Address3, tblCollectionsData.City, tblCollectionsData.Province, tblCollectionsData.PostalCode, tblCollectionsData.HomeNumber, tblCollectionsData.BusinessNumber, tblCollectionsData.Year, tblCollectionsData.Make, tblCollectionsData.Model, tblCollectionsData.Style, tblCollectionsData.Vin, tblCollectionsData.Class, tblCollectionsData.PolicyType, tblCollectionsData.FName, tblCollectionsData.DateUpLoad, tblCollectionsData.PremCancelDate1, tblCollectionsData.Overdue, tblCollectionsData.Closed, tblCollectionsData.CellNumber, tblContact.ContactID, tblContact.Contact, tblContact.ByLetter, tblContact.ccAgent, tblContact.EmployeeAlias, tblContact.ByPhone, tblContact.LeftMessage, tblContact.Promise, tblContact.Other, tblContact.OtherExplain, tblContact.GComments, tblContact.PolicyNumber, tblContact.Message, tblContact.MessageType, tblContact.ContactNumber
FROM tblCollectionsData RIGHT JOIN tblContact ON tblCollectionsData.PolicyNumber = tblContact.PolicyNumber
WHERE (((tblContact.FollowUpDate) Between [Forms]![frmQueue]![txtMoreThanTwo] And [Forms]![frmQueue]![txtMoreThanTwoEnd]) AND ((tblCollectionsData.ContactMain)>="3") AND ((tblCollectionsData.Closed)=0) AND ((tblContact.ContactNumber)="3"))
ORDER BY tblCollectionsData.LName, tblContact.ContactID DESC , tblContact.ContactNumber DESC;