Getting a MAX value out of a table

admin

Administrator
Staff member
Hi;
I have a table that contains 2 fields:
FIELD_A is a program name
FIELD_B is a TIMESTAMP field

I want to extract these as a pair - I want to pull out the MAXIMUM value of FIELD_B and the program name it's related to:

i.e. if I have
program1 20000101010101
program2 20000202020202
program3 20000000000000

then I want a SELECT statement that will pull out the largest value of FIELD_B
and the value of FIELD_A that's on the same row: so in the example above I'd expect to get:

program2 20000202020202

I tried
SELECT MAX(FIELD_B) from TABLE;
and that's fine - it gets the max value of FIELD_B with no trouble, but how do I get the value of FIELD_A out at the same time?

AHMA,
cheers,
Ben
 
Back
Top