Unanswered: Return Data based on Min(date) and Min(date)+1
I need to pull the data from a table based on a person's two earliest/first two LeadDates and am having trouble figuring out how. The data is ordered in the table by StudID and LeadDate. There are a total of 34 columns, all of those need to be returned in the search.
What is the correct MS Access SQL code that I need to use to retrieve the Desired Results as I have typed below. Thanks.
StudID Name LeadDate LeadSource Program
98345 SJones 10/1/09 Referral MBA
98345 SJones 10/1/09 Display MBA
98345 SJones 10/5/09 WEBAD-1 MBA
Based on the above article and some help from another forum, below is the code that I ended up with to pull the absolute data that I needed...First two LeadDates (ie. Inquiries/Leads) per person. I actually had to use the system generated ID in the end in order to pull no more than TWO rows per person, specifically for those people who had multiple inquiries on the same day(s).
FROM SUO_Data_set AS MainData
WHERE MainData.ID In
(Select Top 2 [ID]
WHERE SUO_Data_set.SyStudentID = MainData.SyStudentID
ORDER BY ID ASC)
ORDER BY MainData.SyStudentID, MainData.LeadDate;