Subject Re: [ib-support] Re: Problem with FB's SP
Author Arno Brinkman
Hi,

> To start with, I don't see my message and the replies.
>
> I had to look into the group to find them.

Hmmmm Sometimes you must have patience.

> > I don't see what you want to achieve with this procedure, please
> tell us
> > more.
> >
>
> Ok, say you have 2 tables:
>
> DOC_TABLE composed of
> 1) ID_Table
> 2) ID_Value
> 3) ID_Document
>
> TABLES composed of
>
> 1) ID_TABLE
> 2) VALUE
>
> ID_VALUE in DOC_TABLE means the number of values in the "subtable"
> represented by ID_TABLE.
> To be clearer, immagine that TABLES has 4 elements with the same
> ID_TABLE and a different VALUE value for each record.
> If I have an ID_VALUE of 3 then I want the third of the 4 records.

Thirth ? In what order ?

Maybe something like (untested) :

FOR
SELECT
ID_VALUE
FROM
DOC_TABLE
INTO
:INTVAR
DO BEGIN
SELECT
FIRST 1
SKIP :INTVAR
VALUE
FROM
TABLES
ORDER BY
VALUE
INTO :SOMEVALUE
SUSPEND;
END

Regards,
Arno