Subject | Re: [firebird-support] is there a way around the IN clause? |
---|---|
Author | Lucas Franzen |
Post date | 2004-09-09T07:50:28Z |
Gary,
c.name, c.surname, c.telephone, c.lastorderdate
from customers c
where NOT EXISTS (
select customerlink from orders
where
recdate > '01-jan-2004' and
recdate < '01-feb-2004' and
branchcode = 'SAN'
)
and c.branchcode = 'SAN'
order by
c.lastorderdate desc,1,2
I dare to say that this one is much faster ;-)
Luc.
> The following query takes 44 seconds to return.select
>
> select
> c.name, c.surname, c.telephone, c.lastorderdate
> from customers c
> where c.link not in (select customerlink from orders where recdate >
> '01-jan-2004' and recdate < '01-feb-2004' and branchcode = 'SAN')
> and c.branchcode = 'SAN'
> order by
> c.lastorderdate desc,1,2
c.name, c.surname, c.telephone, c.lastorderdate
from customers c
where NOT EXISTS (
select customerlink from orders
where
recdate > '01-jan-2004' and
recdate < '01-feb-2004' and
branchcode = 'SAN'
)
and c.branchcode = 'SAN'
order by
c.lastorderdate desc,1,2
I dare to say that this one is much faster ;-)
Luc.