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 -> SQL Query Question (Performance)

SQL Query Question (Performance)

From: Seán Hanly <sean_hanly_at_mail.amsinc.com>
Date: 1997/07/01
Message-ID: <33B95A86.A391D292@mail.amsinc.com>#1/1

Given a table structure, (with sample data),

INVOICE


ID        COL1    COL2
1         aaaa    aaaa
2         bbbb    bbbb
2         cccc    cccc

JOIN_TABLE


CUST_ID       INVOICE_ID
1             1
1             2
1             3

I was wondering if somebody could tell me which is more efficent, or a possible 3rd
more efficent query, of the below:

> SELECT
> INVOICE.OID,
> INVOICE.COL1,
> INVOICE.COL2,
> INVOICE.COL3
> FROM INVOICE WHERE INVOICE.OID IN
> (SELECT
> JOIN_TABLE.INVOICE_ID
> FROM JOIN_TABLE
> WHERE
> JOIN_TABLE.CUST_ID = '1');
>
>
> SELECT
> DISTINCT
> INVOICE.OID,
> INVOICE.COL1,
> INVOICE.COL2,
> INVOICE.COL3
> FROM INVOICE, JOIN_TABLE
> WHERE
> JOIN_TABLE.CUST_ID='1';
>

Thanks in advace

....Seán Received on Tue Jul 01 1997 - 00:00:00 CDT

Original text of this message

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