Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL question: SELECT and GROUP BY in Oracle8
>
> select b.*
> from revisions b,
> (select firstid, max(rev) maxrev
> from revisions group by firstid) a
> where b.firstid = a.firstid
> and b.rev = a.maxrev
>
Thank you, your solution works fine in Oracle. But it does not work in Sybase. Ideally I'd like to use the same query in my application for both DBMSs.
I was thinking about putting the max part into a subquery but the problem is that the subquery would return a combination key (firstid and maxrev) for joining with main query.
Matti Received on Fri May 18 2001 - 02:36:10 CDT