i have a database that contains a line for every action i made for a costumer for example:
12/11/13;costumer name a; actions performed
13/11/13;costumer name b; another action performed
..................................
i want to search which costumers didn't requested a repair in the latest year compared to the costumers i worked for the 2 years before
so i made a query as following
select distinct costumername
from BEZOE
where date BETWEEN '2009-06-30 00:00:00.000'
AND '2011-06-30 00:00:00.000'
and date not in(
select costumername from BEZOE where date between '2011-06-30 00:00:00.000'
AND '2012-06-30 00:00:00.000');
still my query is returning lines for costumers i worked for latest year
what can be wrong with the query or is there a problem with my database data? what can be the cause??
You are doing:
Most likely customername is not a datefield :p. You should change
date
tocostumername
: