Highest value only

  • Thread starter Thread starter Dafydd
  • Start date Start date
D

Dafydd

I want a query that will only take the rows with the highest value
into consideration. eg

Sequence Number Item Code
1 1223
1 52
2 445
2 5468
2 415
4 445
4 452
4 256

Therefore, in this example, taking the sequence number as the field of
intrest, only the last three row of data should be used.

Can anyone help me??

All help or advice will be very much appreciated.

Kind regards

Dafydd Hughes
 
Dafydd,

You might try.

SELECT *
FROM MyTable
Where [SequenceNumber] =
(SELECT Max(Temp.[SequenceNumber])
FROM MyTable as Temp)

The above may be faster than the perfectly correct version that Phobos posted.
 
SELECT *
FROM MyTable
Where [SequenceNumber] =
(SELECT Max(Temp.[SequenceNumber])
FROM MyTable as Temp)

The above may be faster than the perfectly correct version that Phobos
posted.

And would have the added advantage of being portable. <g>

P
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top