I need to display multiple fields but need to restrict by the last entry for each individual.

SELECT SSAN, Location, Date_of_Trip
from TblTRIPS
Where
...only want to select the most recent trip

Need help with this. How can I restrict the select statement to the most recent trip for each individual. If I put DISTINCT in the SELECT clause I combines all the fields and give me all the trips for all the individuals...but I only want the most recent.

Thanks,
Al

select distinct ssan, location, max(date_of_trip) from         tbltrips
group by ssan, location
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.