"Alfonso Moscato" <mosca...@tin.it> wrote in message
news:u4ZkEB8pAHA.1480@tkmsftngp04...
If you have only one field that is aggregated by Last, use min, or max. If
you have many fields, you can't use min or max:
F1, F2, F3
a, 1, 100
a, 2, 99
In Jet, SELECT F1, Last(F2), Last(F3) FROM ... GROUP BY F1 will return
either the first either the second record. Using:
SELECT F1, Min(F2), Min(F3) FROM .... will return
a, 1, 99
which is NOT a record from the initial set. So, if you aggregate with Last
on many fields, you have to use a sub-select, along the line:
SELECT A.F1, A.F2, A.F3
FROM Somewhere AS A
WHERE A.PrimaryKey =
(SELECT MIN(B.primaryKey)
FROM somewhere As B
WHERE A.F1=B.F1 )
which can be a translation in MS SQL Server for:
SELECT F1, Last(F2), Last(F3)
FROM Somewhere
GROUP BY F1
in Jet.
Hoping it may help,
Vanderghast, Access MVP
"Alfonso Moscato" <mosca...@tin.it> wrote in message
news:u4ZkEB8pAHA.1480@tkmsftngp04...
[...]