Hello.

What you wrote does not obviously fit to your previous description.

On Tue 2002-11-12 at 16:25:40 -0700, [EMAIL PROTECTED] wrote:
> 
> The problem is that I need all the records between the two occurances of
> identical values in field 2, with no records which occur before or after
> those two occurances.

With "field 2" you seem to refer to the middle column below?

> For example, the following table with 3 fields:

If I understood the problem correctly, the following table must, with
regard to the previous mail, be labeled:

Field0  Field2  Field1

>    1    1     10
>    2    4     99
>    3    2     99
>    4    1     98
>    5    4     88
>    6    2     97
> 
> If the parameter for the second column is 4, I would need to retrieve
> records 2, 3, and 4.
> If the query needs, for simplicity, to return record 5, that could be
> handled by the program.

You never mentioned before that the last column should not be
contained in the result set. You can change the suggestion from my
other mail by replacing BETWEEN with the appropriate comparisons
operators (">=" and "<").

HTH,

        Benjamin.


[...]
> > With the following Database structure:
> > Field0 Integer Autonumber
> > Field1 Integer Unique
> > Field2 Integer not unique
> >
> > where the starting record would be selected by Field1 (an indexed field of
> > unique values).
> >
> > The ending record required would be the first succeeding record where the
> > value of Field2 is equal to the value of Field2 in the 'starting' record.
> >
> > Field2 is NOT unique and not ordered.
> > The result would be ordered by Field0 (the autonumber field)
[...]

-- 
[EMAIL PROTECTED]

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to