|
carrie -> RE: Inner Joins (6/22/2006 12:05:38)
|
Thanks so much Mark, but the records are from 2 different tables. The dates are in one table (and each record may have more than one date), and the names are in the other. I assumed I needed to join the two tables, but I only want to pull one date record for each name record, the most recent date older than 25 days. This is as close as I have gotten, but I think it's returning all of the records, not just the one I'm asking for: "Select ListingLeads.ContactID, ListingLeads.Last_Name, ListingLeads.First_Name, " _ & "ListingLeads.Prop_Addr, ListingLeads.Category, " _ & "ListingLeadsMailType.DateSent from ListingLeads " _ & "INNER JOIN ListingLeadsMailType ON ListingLeads.ContactID = ListingLeadsMailType.ContactID " _ & "WHERE datediff('d',(Select Max(DateSent) from ListingLeadsMailType), '" &date&"') > 25" To me, the query above says, 'Select the contactid, last name, first name, property address, category and datesent, where the difference in the amount of days between the most recent date and today's date is greater than 25. But it's giving me every record - sometimes more than once, instead of just the records I think I'm asking for. Carrie
|
|
|
|