Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
supreme writes "I have multiple records in a table.Ex. Name , number, date.I like to retrieve all the names and numbers that did business with us. But the same names might have done business multiple times. I need the last time that they did business with us.The latest record for each name."
Page47
Master Smack Fu Yak Hacker
2878 Posts
Posted - 2002-04-26 : 11:18:50
select distinct<O>
MuffinMan
Posting Yak Master
107 Posts
Posted - 2002-04-26 : 11:24:08
select a.*from MyTable ainner join ( Select Name, Number, Max(Date) as Date from MyTable group by Name, Number) bon a.Name = b.Name and a.Number = b.Number and a.Date = b.Date