Getting a max number in query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi

I am trying toget a query to display the max numbe only. I have a field
linked to other fields, this field stored a number for a report version.
Usually this is 1, but sometimes it can be 2 or 3 etc. How can I get the
query to only display the data for the max number in that field, be it 1,2 3
etc. Is this indeed possible. At the min I get duplicate records for results
that have more than one report version, ie the query displays all report
versions rather than the most recent, or max number.

Many Thanks
 
SELECT *
FROM SomeTable
WHERE Version = (SELECT Max(Version) FROM SomeTable st WHERE st.OtherField =
SomeTable.OtherField)
 
Back
Top