Subject Re: Selecting invoices between specific dates?
Author legrand_legrand_63
--- In, Robin Davis <Ro.Davis@...> wrote:
> Hi,
> I'm obviously missing something here.
> We have a table of invoices and we want to send Christmas cards to any
> NEW clients in 2006. I am trying to select by invoicedate, which is
> straight forward, but how in hell do I select people from that list who
> we have billed in 2006 but NOT in previous years?
> Sorry, my brain has gone to mush!
> Rob Davis
Could you try something like:

select distinct name from invoices a
where invoicedate >= '2006.01.01'
and not exists (select 1 from invoices b
where invoicedate < '2006.01.01'
and )