WurzelGummidge
Technical User
Hi,
I want to do the following but can't decide / think what the simplest Sql statement would be to use:
I have an 'ORDERS' table with fields:
CUSTOMER,ORDER_DATE,PRODUCT
Data could look like this:
CUST1 03/01/03 ABC123
CUST1 17/03/03 ABC123
CUST1 23/11/01 XYZ321
CUST2 09/02/02 ABC123
CUST3 12/12/02 QRS123
CUST3 19/09/03 XYZ123
What i would like to do is to return (distinct) customers that HAVE ordered this year, DID NOT order last year, but DID order the year before that!
Hope this is understandable
I want to do the following but can't decide / think what the simplest Sql statement would be to use:
I have an 'ORDERS' table with fields:
CUSTOMER,ORDER_DATE,PRODUCT
Data could look like this:
CUST1 03/01/03 ABC123
CUST1 17/03/03 ABC123
CUST1 23/11/01 XYZ321
CUST2 09/02/02 ABC123
CUST3 12/12/02 QRS123
CUST3 19/09/03 XYZ123
What i would like to do is to return (distinct) customers that HAVE ordered this year, DID NOT order last year, but DID order the year before that!
Hope this is understandable