
Alfons
|
| Posted: 08/10/2004, 11:36 AM |
|
I want to know how to show a record after search it and the next and the previous of that record.
For example, a table with 20 records. If record 17 is "Numancia" in the field 'name', then I want to show records 16, 17 and 18.
Can anybody help me?
Thanks
|
|
|
 |
DonB
|
| Posted: 09/05/2004, 8:04 PM |
|
Querying for
SELECT * from table WHERE primarykey between
(SELECT MAX(primarykey) FROM table where primarykey < middlevalue) AND
(SELECT MIN(primarykey) FROM table where primarykey > middlevalue)
;
is (barring any syntactic errors I might have made) one solution. The
"middlevalue" is "17" in your example.
--
DonB
http://www.gotodon.com/ccbth
"Alfons" <Alfons@forum.codecharge> wrote in message
news:6411915c46d1d1@news.codecharge.com...
> I want to know how to show a record after search it and the next and the
> previous of that record.
>
> For example, a table with 20 records. If record 17 is "Numancia" in the
field
> 'name', then I want to show records 16, 17 and 18.
>
> Can anybody help me?
>
> Thanks
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
|

|
|
|
|