0

I have a field that I would like to get the max value of but it is a varchar2(6) field, all numerals. I am unable to change the type of field

The field is a date listed like this 201307 for July 2013. Just using MAX does not work.

Using oracle.

user1466935
  • 7
  • 1
  • 4
  • 1
    What's not working when using `max()`? – GriffeyDog Aug 13 '13 at 19:33
  • If the data is supposed to represent a Month, what do you mean by "max value"? It would be reasonable to assume that by "max" you actually mean "latest", so as Matt says, `MAX()` should work fine. – Jeffrey Kemp Aug 14 '13 at 05:06

1 Answers1

0
SELECT MAX(date) "MostRecent" FROM tablename;

Should work. YYYYMM is going to sort as newest first in a MAX aggregate or analytic function in Oracle.

Matt Pavelle
  • 819
  • 5
  • 8