Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL question: SELECT and GROUP BY in Oracle8

Re: SQL question: SELECT and GROUP BY in Oracle8

From: Matti Teppo <matti.teppo_at_nospam.datex-ohmeda.com>
Date: Fri, 18 May 2001 09:36:10 +0200
Message-ID: <3B04D0EA.A3055E06@nospam.deio.net>

>
> 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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US