I have a table and assume it has 3 fields, they are f1, f2, f3, right now I want a SQL to group by f1 and f2 then sort f3 in each group in ASC or DESC order and query out the third one in each group in f3, how to write the SQL query. for example:
f1 f2 f3
A A 2
A A 3
A A 1
A B 4
A B 6
A B 2
in ASC order in each group, the query result should like this, get the third one:
A A 3
A B 6
in DESC order in each group, the query result should like this, get the third on:
A A 1
A B 2
is there a way to query the table and get a result like above in Oracle?