| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: SQL question: GROUP BY and MAX
Yes, this works! Even with the enhanced sample data where id values are not in
ascending order.
But how come the GROUP BY can be replaced with a join between the main query and subquery???
Thanks,
Matti
Jan Hidders wrote:
> SELECT *
> FROM revisions r1
> WHERE r1.rev IN ( SELECT MAX(r2.rev)
> FROM revisions r2
> WHERE r1.firstid = r2.firstid );
>
> But I didn't test this.
Received on Wed May 23 2001 - 05:57:06 CDT
![]() |
![]() |