How to do a difference on two sets from same table?
From: Dan <dan_at_nospam.com>
Date: Fri, 27 Aug 2004 15:23:39 -0500
Message-ID: <sLMXc.36$h43.33141_at_news.uswest.net>
Hi,
Date: Fri, 27 Aug 2004 15:23:39 -0500
Message-ID: <sLMXc.36$h43.33141_at_news.uswest.net>
Hi,
Say I have a sales history table that has the following fields: custid,
invoicedate, prodid, quantity, cost, sale. And that I want to select
sales records where invoicedate is between 5/1/04 and 8/31/04 and where
these are new sales for each customer, meaning that the customer did not
buy the prodid in the period 1/1/04 to 4/30/04. I know conceptually
that this is a difference between two sets based on custid+prodid but I
don't know how to express this in SQL. Please help.
TIA,
Dan
Received on Fri Aug 27 2004 - 22:23:39 CEST