sql - select multiple fields from most recent record from an oracle table -


i want this:

select max(field1), field2 tbl1 group field1 

but above query doesn't work (sqlplus throws error). how can achieve above in single query (for now, have split 2 queries result).

you use inline view , analytic function (max() over()) in selecting row(s) largest timestamp:

select field1, field2      (select field1, field2, max(field1) over() max_field1      tbl1) field1 = max_field1; 

note if there many records timestamp value of max_field1, returned (in arbitrary order).


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -