Subject | Master-detail group by problem |
---|---|
Author | Harriv |
Post date | 2009-04-19T15:57:54Z |
Hi,
I've master - detail tables, and detail has also FK to another master
table. Basically
MASTER
========
MasterID integer
DETAIL
=======
DetailID integer
MasterID integer
SecondMasterID integer
I'm doing query "Select ... from master where Master.MasterID =
Detail.MasterID"
Now I want to limit the result set for the query so that it contains only
Master rows where all the detail rows have same SecondMasterID for that
specific MasterID, how do I limit that in Firebird 1.5?
Something like "Select .. from master where Master.MasterID =
Detail.MasterID and (select number of rows from detail where Master.MasterID
= Detail.MasterID) = 1" in "pseudo SQL".
[Non-text portions of this message have been removed]
I've master - detail tables, and detail has also FK to another master
table. Basically
MASTER
========
MasterID integer
DETAIL
=======
DetailID integer
MasterID integer
SecondMasterID integer
I'm doing query "Select ... from master where Master.MasterID =
Detail.MasterID"
Now I want to limit the result set for the query so that it contains only
Master rows where all the detail rows have same SecondMasterID for that
specific MasterID, how do I limit that in Firebird 1.5?
Something like "Select .. from master where Master.MasterID =
Detail.MasterID and (select number of rows from detail where Master.MasterID
= Detail.MasterID) = 1" in "pseudo SQL".
[Non-text portions of this message have been removed]