Subject | Where Clause in LookupCombo causes Multiple rows in singleton select error |
---|---|
Author | |
Post date | 2015-04-12T19:12:28Z |
I have a query with a few "normal" fields plus two IDs which are populated using TIB_LookupCombos.
At first, both LookupCombos simply selected all data from the underlying table and everything worked fine.
Then I had to limit the data in the second LookupCombo based on the selection of the first LookupCombo.
I did so by using the AfterScroll event of the first LookupCombo and adding a where clause to the query of the second LookupCombo.
The actual queries are difficult to read, so here in pseudocode what the two queries look like:
First
Select ID, Supplier from TableSupplier
Second
Select B.ID, B.Branch, B2S.SupplierID
from TableBranches B
join Branches_X_Supplier B2S on B.ID=B2S.BranchID
where B2S.SupplierID=:Supplier_ID
Now, as soon as the the where condition is set, I get a Multiple rows on singleton select error.
What I don't understand, with the where condition in place, I get much less data than w/o it and still get the error.
Any hint on how to find the culprit would by very welcome.
Florian
At first, both LookupCombos simply selected all data from the underlying table and everything worked fine.
Then I had to limit the data in the second LookupCombo based on the selection of the first LookupCombo.
I did so by using the AfterScroll event of the first LookupCombo and adding a where clause to the query of the second LookupCombo.
The actual queries are difficult to read, so here in pseudocode what the two queries look like:
First
Select ID, Supplier from TableSupplier
Second
Select B.ID, B.Branch, B2S.SupplierID
from TableBranches B
join Branches_X_Supplier B2S on B.ID=B2S.BranchID
where B2S.SupplierID=:Supplier_ID
Now, as soon as the the where condition is set, I get a Multiple rows on singleton select error.
What I don't understand, with the where condition in place, I get much less data than w/o it and still get the error.
Any hint on how to find the culprit would by very welcome.
Florian