Jumat, 21 September 2018

Re: [MS_AccessPros] Need to stop duplicate records

 

Hi Art,


I would try something using a subquery in the criteria. It would be a little simpler if you could provide the primary key field of tblApplication. This query assumes the Application Received date and time are both populated.


SELECT qryApplicantExtended.ApplicantID,
 qryApplicantExtended.[Applicant Name],
 tlkpApplicationType.ApplicationTypeName,
 qryApplicantExtended.HomePhone,
 tlkpGender.GenderName,
 qryApplicantExtended.MobilePhone,
 qryApplicantExtended.WorkPhone,
 tblApplication.AppReceivedDate,
 tblApplication.AppReceivedTime
FROM ((qryApplicantExtended
 INNER JOIN tlkpApplicationType ON qryApplicantExtended.ApplicationTypeID = tlkpApplicationType.ApplicationTypeID)
 INNER JOIN tlkpGender ON qryApplicantExtended.GenderID = tlkpGender.GenderID)
 LEFT JOIN tblApplication ON qryApplicantExtended.ApplicantID = tblApplication.ApplicantID
WHERE qryApplicantExtended.ApplicantStatusTypeID=4
 AND AppReceivedDate + AppReceivedTime =
 (SELECT TOP 1 AppReceivedDate + AppReceivedTime
  FROM tblApplication A 
  WHERE A.ApplicantID = tblApplication.ApplicantID 
  ORDER BY AppReceivedDate Desc, AppReceivedTime DESC)
ORDER BY qryApplicantExtended.LastName;

Regards,
Duane


From: MS_Access_Professionals@yahoogroups.com <MS_Access_Professionals@yahoogroups.com> on behalf of dbalorenzini@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com>
Sent: Friday, September 21, 2018 1:25 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Need to stop duplicate records
 


I have the following query:

SELECT qryApplicantExtended.ApplicantID, qryApplicantExtended.[Applicant Name], tlkpApplicationType.ApplicationTypeName, qryApplicantExtended.HomePhone, tlkpGender.GenderName, qryApplicantExtended.MobilePhone, qryApplicantExtended.WorkPhone, tblApplication.AppReceivedDate, tblApplication.AppReceivedTime
FROM ((qryApplicantExtended INNER JOIN tlkpApplicationType ON qryApplicantExtended.ApplicationTypeID = tlkpApplicationType.ApplicationTypeID) INNER JOIN tlkpGender ON qryApplicantExtended.GenderID = tlkpGender.GenderID) LEFT JOIN tblApplication ON qryApplicantExtended.ApplicantID = tblApplication.ApplicantID
WHERE (((qryApplicantExtended.ApplicantStatusTypeID)=4))
ORDER BY qryApplicantExtended.LastName;


Which is returning duplicate applicants. I understand why its happening. It because and applicant can have more then one application. How can I get it to return the latest application which would eliminate duplicate?

Thank you 

Art Lorenzini
Sioux Falls, SD


__._,_.___

Posted by: Duane Hookom <duanehookom@hotmail.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


SPONSORED LINKS
.

__,_._,___

Tidak ada komentar:

Posting Komentar