|
-
Apr 28th, 2011, 11:48 PM
#1
Thread Starter
Addicted Member
Slow query for multi condition [WHARE]
I have a query like this:
select * from
(
select
a.storecode,a.salenumber ,a.productcode,a.quantity,c.saletime,
LEFT(a.productcode,2) as brand,
SUBSTRING(a.productcode,6,4) as coll
from
saleline as a LEFT JOIN
sale AS c ON a.salenumber = c.salenumber and a.storecode=c.storecode
)
as f
where
f.brand = 'AR'
when I execute running normally (when the process is briefly)
but when I add the condition like this:
where
f.brand = 'AR' and
f.saletime<= '2011-01-31'
very slow
i use sql server 2008
how to fix this problem ?
thank you
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|