Subject Re: Problem with FB's SP
Author deerbear2001
--- In ib-support@y..., Lucas Franzen <luc@r...> wrote:
Hello,

To start with, I don't see my message and the replies.

I had to look into the group to find them.

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

So, I just want to count the records and fetch the one I want.

> If you want to return just the rows from TABELLE which have a
>ceratin
> number of occurances in DOC_TABELLA, youc an use plain SQL like:
>
> SELECT T.VALORE FROM TABELLA T
> JOIN DOC_TABELLA D ON [join expression]
> GROUP BY T.TABELLA
> HAVING COUNT (*) > YOUR_REQUESTED_COUNT

Wish it was that easy, but I fear it's not :)

> Regards
> Luc.

Regards,

Andrew