Subject | select datafield from mytable where lastchanged [is the biggest] |
---|---|
Author | (no author) |
Post date | 2003-07-04T14:00:21Z |
Hi :)
Assume I have a table with following fields:
dset varchar(3)
mynr varchar(10)
lastchanged integer
datafield integer
Any combination of dset,mynr,lastchanged is unique.
What I need is a subset of this table, with only the rows where
lastchanged is the biggest for each combination of dset and mynr.
An example:
dset mynr lastchanged datafield
100 001 1 1234
100 001 2 32
100 001 3 324
100 001 4 1423
100 002 1 54
100 002 2 34
100 002 3 765
Would give me
100 001 4 1423
100 002 3 765
Is this possible using a single query?
Thanks
Luca
Assume I have a table with following fields:
dset varchar(3)
mynr varchar(10)
lastchanged integer
datafield integer
Any combination of dset,mynr,lastchanged is unique.
What I need is a subset of this table, with only the rows where
lastchanged is the biggest for each combination of dset and mynr.
An example:
dset mynr lastchanged datafield
100 001 1 1234
100 001 2 32
100 001 3 324
100 001 4 1423
100 002 1 54
100 002 2 34
100 002 3 765
Would give me
100 001 4 1423
100 002 3 765
Is this possible using a single query?
Thanks
Luca