Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Oracle Miscellaneous > Re: Nasty Query...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 4 Topic 6828 of 7279
Post > Topic >>

Re: Nasty Query Here

by patrick <pgovern@[EMAIL PROTECTED] > Apr 11, 2008 at 10:46 AM

Very confusing
  query has customer_account ca
  subquery has customer_address ca
     while ca is now customer_account

May want to look at rewriting the subquery as exists/not exists
something like
and not exists (select 'x' from customer c2,
                                customer.subscriptions s2,
                                customer.product p2,
                                customer_address ca2,
                                customer_account ct2,
                                visitor v2
                 where c2.customer_id = c.customer_id
                   and c2.email = c.email
                   and ca2.customer_id = c2.customer_id
                   and ca2.address_type_id = 1
                   and s2.customer_id = c2.customer_id
                   and s2.status = 1
                   and s2.sell_rep_id IN (201, 202)
                   and p2.produst_id  = s2.produst_id
                   and p2.produst_id = 1
                   and TRUNC(start_date) BETWEEN p_start_date AND
p_end_date
                   and ct2.customer_id = c2.customer_id
                   and v.customer_id (+) = c2.customer_id)

Also are customer_account ct2 and visitor v2 really
needed in the subquery.

====>Pat
 




 4 Posts in Topic:
Nasty Query Here
Mtek <mtek@[EMAIL PROT  2008-04-09 10:51:14 
Re: Nasty Query Here
Charles Hooper <hooper  2008-04-09 17:30:35 
Re: Nasty Query Here
patrick <pgovern@[EMAI  2008-04-11 10:46:54 
Re: Nasty Query Here
Mtek <mtek@[EMAIL PROT  2008-04-16 08:30:55 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 20:43:24 CST 2008.