On Sun, Sep 7, 2008 at 12:17 PM, NickC <[EMAIL PROTECTED]> wrote: > Slight progress but no idea why! > > > Three ways that don't work (too slow): > > SELECT MIN(OrdNo) FROM Orders WHERE OrdNo > cLastPONum > > SELECT TOP 1 OrdNo FROM Orders WHERE OrdNo > cLastPONum ORDER BY OrdNo ASC > > SELECT * FROM Orders WHERE OrdNo IN ; > (SELECT TOP 1 OrdNo FROM Orders WHERE OrdNo > cLastPONum ; > ORDER BY OrdNo ASC) > > > And one way that does work: > SELECT OrdNo FROM Orders WHERE OrdNo > cLastPONum ORDER BY OrdNo INTO CURSOR > Temp1 > cOrdNo = Temp1.OrdNo > > However put a MIN, MAX or TOP 1 on and it goes excruciatingly slow again. -------------------------------------------------
how many indexes on Ordno? Why not make a fake table to hold just the orders for the past ??? 180 days perhaps. Now your NEXT or Prev. navigation will give you the actual value you then do your query for. -- Stephen Russell Sr. Production Systems Programmer Mimeo.com Memphis TN 901.246-0159 _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

