Monday, March 12, 2012

Help with a "select"

All of my customers are in a single data file, with one record per customer for each year that the customer bought something. (If customer A bought something in 1993, he would have a customer record in the file for that year. If he did not buy something in 2004 he would have no customer record for 2004 in the file.)

I want to "select" customer records from the file for which there is a 1993 record, but no 2004 record.

What would the select syntax be like?

Thanks in advance.Roughly:

Select * from Customers where Year(Fieldname) = '1993' and Customers.Cust_ID not in(select Cust_ID from Customers where Year(Fieldname) = '2004')

No comments:

Post a Comment