Re: sql question
- Posted by Matt Lewis <matthewwalkerlewis at yahoo.com> Oct 07, 2003
- 359 views
--- George Walters <gwalters at sc.rr.com> wrote: > > > I would like to find a customer or part number in a data base then scroll > (next and/or previous) around that customer or part number. > > For example I have tried "select * from inventory where partNbr = 1234"..... > then "select * from inventory where partNbr < lastPartNbr" but that doesen't > work. It will give me the first in the file.... which is a lesser number but > not the lesser one in index order. But strangely enough "select * from > inventory where partNbr > lastPartNbr" does give me the next in index order. > > Any body got any ideas on this? Your first try should give you all parts less than, but probably sorted in a non-useful way. Try: select * from inventory where partNbr < lastPartNbr order desc by partNbr And you should have them in a useful order. Likewise, I'd recommend: select * from inventory where partNbr > lastPartNbr order by partNbr Matt Lewis __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com