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] how to avoid an inner join

Re: [SQL] how to avoid an inner join

From: Svend Jensen <svend_at_oraclecare.com>
Date: Mon, 17 Sep 2001 19:48:37 +0200
Message-ID: <3BA63775.C6DAFCAA@oraclecare.com>


Harald,
convert the inner join to a inline view, like select * from table a,(select whatever_needed from table b where max(column_name) <= sysdate) b
where a.something = b.something
and....

This can avoid a select max(something) for every candidate row in the table a.

/Svend Jensen

Harald Fischer-Hohlweck wrote:

> Hi.
>
> Assume a table having a key Key and a column ValidFrom (ValidFrom is a
> date). All rows with a definite Key have different ValidFrom's. Can I
> get the row with the youngest ValidFrom in the past (i.e. the row that
> is valid actually) without an inner join? Something like
> select * from table
> where Key = value and ValidFrom = "max(ValidFrom) <= today";
>
> I'm no database expert, but I anticipate performance problems if I have
> to do the inner join.
>
> Sincerely
> Harald
> --
> Harald Fischer-Hohlweck mailto:Harald.Fischer-Hohlweck_at_ibix.de
>
> IBIX Informationssysteme GmbH http://www.ibix.de
> Vor dem Lauch 19 fon : +49-711-7256-324
> 70567 Stuttgart (Germany) fax : +49-711-7256-414
Received on Mon Sep 17 2001 - 12:48:37 CDT

Original text of this message

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