Can you try a couple of things?

1) rewrite the query as:

Select c.sman, o.ordnum, o.orddate, o.cust
From customers c
join orders o
on C.cust = o.cust and o.orddate >= '01/01/2009'
Where c.sman like '40%'
Order by c.sman, o.ordnum desc;

The query engine should be smart enough to rewrite the query, but just
in case...

2) Try the rewritten query w/out the order by and see if it's faster. If
so you know it's the order by

3) Flip the query (again the engine should be smart enough, but...)

Select c.sman, o.ordnum, o.orddate, o.cust
From orders o
join customers c
on C.cust = o.cust and c.sman like '40%'
Where o.orddate >= '01/01/2009'
Order by c.sman, o.ordnum desc;




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.