1. sql question

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?

george

new topic     » topic index » view message » categorize

2. Re: sql question

--- 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

new topic     » goto parent     » topic index » view message » categorize

3. Re: sql question

Thanks Matt,... that was close enough. Here's the statement.

select * from inventory where partNbr < lastPartNbr order by partNbr desc"

george

----- Original Message -----
From: "Matt Lewis" <matthewwalkerlewis at yahoo.com>
To: "EUforum" <EUforum at topica.com>
Subject: Re: sql question


>
>
> --- 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
>
>
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu