one of my job interview questions was this. I answered with order by and he ask me even in trillion rows? I accepted my mistake and say I guess there is an option for MAX() maybe!!
in these questions:
Using LIMIT within GROUP BY to get N results per group?
SQL select nth member of group
the trillion rows not considered and performance is low.
but after many search I found that even answered questions are not right for large scale rows. anybody know what is the correct query?