Re: RgueWave and Join two Table
Date: Fri, 19 Oct 2001 09:53:56 +0200
Message-ID: <3BCFDC14.B29A5086_at_fct.de>
Theo Peterbroers schrieb:
> Josef Böhm <boehm_at_fct.de> wrote in message news:<3BCEA7CE.54EB7FDA@fct.de>...
> > How can I make the following statement with the RougueWave BDTool++ ?
> >
> > SELECT *
> > FROM TableObj, (select objnr as OBJ_NR, MAX(version) as MAX_NR from
> > TableObj Groupby objnr)
> > WHERE objnr = OBJ_NR and version = MAX_NR
> >
> > Do someone has an other idea to make this statement ?
> >
> > Thanks Josef Boehm
>
> SELECT objnr AS OBJ_NR, MAX(version) as MAX_NR
> FROM TableObj as t
> GROUP BY objnr
>
> Other SELECTED columns must also be specified in GROUP BY
No, the result is not the same, when i use GROUP BY.
Another solution is this:
SELECT *
FROM TableObj
where (objnr,version) in
(SELECT objnr AS OBNR, MAX(version) AS MAX_VERS FROM TableObj GROUP BY objnr )
But the command 'IN' in RogueWave DBTools++ ist not supported with subqueries. I need this expression with the 'EXISTS' command. Do someone has an idea ?
Thanks Josef Boehm Received on Fri Oct 19 2001 - 09:53:56 CEST
