Right Parenthesis

From: Mtek <mtek_at_mtekusa.com>
Date: Tue, 29 Apr 2008 08:38:45 -0700 (PDT)
Message-ID: <6b6c3b98-13bf-44b1-bb04-03b30314e957@d1g2000hsg.googlegroups.com>

Hi,

I have this query, it works fine:

SELECT customer_id
FROM (
 SELECT MAX(a.action_date), a.customer_id  FROM email_product_hist a, email_product_hist b  WHERE a.action_date = b.action_date
   AND a.customer_id NOT IN
   (SELECT c.customer_id
    FROM new_customer.customer_account c)    AND a.customer_id IN
  (SELECT d.customer_id
   FROM email_product_hist d
   WHERE action = 'A'

     AND email_product_id = 'PPM'
     AND action_date BETWEEN TO_DATE('01012005','MMDDYYYY') AND
TO_DATE('03312005','MMDDYYYY'))
 GROUP BY a.customer_id)
 ORDER BY customer_id;

Now, they want to add email to it:

SELECT customer_id, email..........
FROM (
.
.
.

   WHERE action = 'A'

     AND email_product_id = 'PPM'
     AND action_date BETWEEN TO_DATE('01012005','MMDDYYYY') AND
TO_DATE('03312005','MMDDYYYY')) So, I assume that I need to give this subquery a name and add the table with the email and the join:

   WHERE action = 'A'

     AND email_product_id = 'PPM'
     AND action_date BETWEEN TO_DATE('01012005','MMDDYYYY') AND
TO_DATE('03312005','MM,DDYYYY')) a, customer_table

That gives me some "missing right parenthesis" error.........search me. I've tried multiple combinations. Received on Tue Apr 29 2008 - 10:38:45 CDT

Original text of this message