query

From: <amerar_at_iwc.net>
Date: Tue, 6 May 2008 13:54:19 -0700 (PDT)
Message-ID: <3615735f-3a43-40f0-8c6e-6f5ce4c8aa7d@m44g2000hsc.googlegroups.com>

This simple query is driving me nuts.

I have a simple table:

customer_id
action_date
action

I want to get a distinct count of customer_id where the action = 'A' and the MAX action date is between 01/01/2005 and 03/01/2005.

This seems simple, and here is my query:

SELECT MAX(action_date) action_date, count(distinct(customer_id)) FROM email_product_hist
WHERE action = 'A'
  AND action_date BETWEEN TO_DATE('01012005','MMDDYYYY') AND TO_DATE('03312005','MMDDYYYY')
  AND customer_id NOT IN (SELECT customer_id FROM customer_account);

But people are telling me that this does not render the correct results.......is there something I am missing??

Thanks! Received on Tue May 06 2008 - 15:54:19 CDT

Original text of this message