Subject Re: [IBO] Bug in IBOQuery: Infinite occurrence of Error message "Multiple Rows in Singleton Fetch"
Author Helen Borrie
At 12:00 PM 17-11-02 +1030, you wrote:
>Bug in IBOQuery: Infinite occurrence of Error message "Multiple Rows in
>Singleton Fetch"

Ahem, would you like to retitle that to something more apposite, like
"IBOQuery found my bugs"?

I've spent about three hours on your query this afternoon, trying to
explain why it can't produce a searchable dataset. I've arrived at several
places, each of which tells me that you don't need to have either a union
or correlated subqueries to get the dataset you need.

So I'd like to start by asking you what *information* you want this dataset
to generate. Would you please answer that in human English. For example,
from this (SQL bugs and all):

SELECT ID, Name, Sex, "SIre ID" AS ParentID FROM Animal A1
WHERE Sex = 'M'
AND NOT EXISTS (SELECT "Sire ID" FROM Animal A2 WHERE A2."Sire ID" = A1.ID)
UNION
SELECT ID, Name, Sex, "Dam ID" AS PreantID FROM Animal A1
WHERE Sex = 'F'
AND NOT EXISTS (SELECT "Dam ID" FROM Animal A2 WHERE A2."Dam ID" = A1.ID)

it appears that you are asking for two gi-knackerous Cartesian products here,

"for each male animal XY in the table, show me all of the animals whose
sire was not animal XY and for each female animal XX in the table, show me
all of the animals whose dam was not animal XX".

whereas what you are after is probably something a lot simpler, smaller,
easier to get, and capable of being made to behave as a searchable dataset.

Helen