Re: SQL question: GROUP BY and MAX
From: Matti Teppo <matti.teppo_at_nospam.deio.net>
Date: Wed, 23 May 2001 12:57:06 +0200
Message-ID: <3B0B9781.9AEA1635_at_nospam.deio.net>
Date: Wed, 23 May 2001 12:57:06 +0200
Message-ID: <3B0B9781.9AEA1635_at_nospam.deio.net>
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 - 12:57:06 CEST