suppose i need to print
select field1,max(field2) from table1
here by field1 mean value of field1, whcih is correpsonding to tuple in the value at max(field2).
How can this be done?
for Example
| 49 | 2000 |
| 50 | 2001 |
| 63 | 2002 |
| 79 | 2003 |
Here the maximum value is 79, which is of year 2003, but the above select statement willreturn
79 2000
How can i get the output like
79 2003
This is an example, and i am looking for a generic method.
I know I could first use order by
clause and then limit 1
, or I can write a subquery like Having abc >=All(some subquery)
,aint there any other method, which is less expensive?