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.
Author |
Topic |
Freak
Starting Member
3 Posts |
Posted - 2008-07-09 : 07:57:19
|
Hi, this is my table in MS Access 2003:Name_ Date_John 6/12/2008 10:00:00John 6/14/2008 09:45:00Mike 5/10/2008 01:30:00Mike 7/7/2008 04:40:00Name_ is Text and Date_ is DateTime. None is Primay Key.How to get this result:John 6/14/2008 09:45:00Mike 7/7/2008 04:40:00Name of the people which Date_ is the "newest" of all in table.I tried like this:select Name_,Date_ from LogsGrup by Name_, Date_HAVING MAX(Date_); but it doesn't work. |
|
Freak
Starting Member
3 Posts |
Posted - 2008-07-09 : 08:00:25
|
This work but only for one Name:select Name_, Date_from LogsWhere Name_ LIKE "Mike"Group by Name_, Date_HAVING MAX(Date_); |
 |
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2008-07-09 : 08:14:27
|
Just the maximum date for each person in the table?try...SELECT [name_] , MAX([date_])FROM LogsGROUP BY [name_] -------------Charlie |
 |
|
Freak
Starting Member
3 Posts |
Posted - 2008-07-09 : 08:53:53
|
Transact Charlie thanks a lot. I owe you a beer.I found this also:GROUP BY... was added to SQL because aggregate functions (like SUM) return the aggregate of all column values every time they are called, and without the GROUP BY function it was impossible to find the sum for each individual group of column values. |
 |
|
|
|
|