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: simple sql question

Re: simple sql question

From: EdStevens <quetico_man_at_yahoo.com>
Date: Tue, 07 Aug 2007 12:36:48 -0700
Message-ID: <1186515408.805093.183820@w3g2000hsg.googlegroups.com>


On Aug 7, 1:19 pm, Tony Kim <tonyi..._at_gmail.com> wrote:
> hi, i'm a newbie and can't figure something as simple as this.
> I have 3 tables and i was wondering if there was a "cleaner" way of
> doing this..
>
> select a.REQUEST_ID, b.PURCHASE_ORD_NUM, c.SON, b.REQUEST_STATUS,
> b.COMPANY_CODE, a.log
> from LAS.LRT107_MOG_LOG a, LAS.LRT002_REQUEST b,
> LAS.LRT250_PEND_ORD c
> where a.REQUEST_ID > '200703'
>
> and a.REQUEST_ID=b.REQUEST_ID
> AND b.REQUEST_ID = C.REQUEST_ID
>
> and b.BUSINESS_UNIT = 'P'
> and a.LOG NOT LIKE '%MIGR=P%'
> and a.LOG LIKE '%SOS%'
> and b.RECEIPT_MODE = 'LEX'
> AND b.REQUEST_STATUS LIKE '%F%'
> and b.REQ_TYPE = 'CB'
> and b.ACTIVITY = 'V'
> and B.RECEIPT_MODE = 'LEX'
>
> thanks!

The first thing I see is ...

and a.LOG NOT LIKE '%MIGR=P%'
and a.LOG LIKE '%SOS%'

without knowing the data, I wonder if the LIKE might make the NOT LIKE unnecessary.

Other than that, I don't know how much cleaner you can get. It's really a pretty simple query. You might look at the JOIN syntax and compare the resulting EXPLAIN PLAN. Received on Tue Aug 07 2007 - 14:36:48 CDT

Original text of this message

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