Subject select 2 detail table rows...
Author tstayfun
Hi everybody...

Can i select detail tables like this???


M.Tmp, D1.Tmp1, D2.Tmp2
A D1A1 AAA1
A D1A2 AAA2
A <null> AAA3
B D1B1 BB1
B D1B2 BB2
B D1B3 <null>


METADATA IS HERE......


Create Table TestMaster(
MRec Integer Not null,
Tmp VarChar(10),
Primary Key (MRec)
);

create table TestDetail1(
RecID Integer Not Null,
MRec Integer Not Null,
Tmp1 VarChar(10),
Primary Key (RecID),
CONSTRAINT FK_Detail1 FOREIGN KEY (MRec) REFERENCES TestMaster(MRec)
);

create table TestDetail2(
RecID Integer Not Null,
MRec Integer Not Null,
Tmp2 VarChar(10),
Primary Key (RecID),
CONSTRAINT FK_Detail2 FOREIGN KEY (MRec) REFERENCES TestMaster(MRec)
);

commit

INSERT INTO TESTMASTER (MREC, TMP) VALUES (1, 'A');
INSERT INTO TESTMASTER (MREC, TMP) VALUES (2, 'B');
COMMIT;
INSERT INTO TESTDETAIL1 (RECID, MREC, TMP1) VALUES (1, 1, 'D1A1');
INSERT INTO TESTDETAIL1 (RECID, MREC, TMP1) VALUES (2, 1, 'D1A2');
INSERT INTO TESTDETAIL1 (RECID, MREC, TMP1) VALUES (3, 2, 'D1B1');
INSERT INTO TESTDETAIL1 (RECID, MREC, TMP1) VALUES (4, 2, 'D1B2');
INSERT INTO TESTDETAIL1 (RECID, MREC, TMP1) VALUES (5, 2, 'D1B3');
COMMIT;
INSERT INTO TESTDETAIL2 (RECID, MREC, TMP2) VALUES (1, 1, 'AAA1');
INSERT INTO TESTDETAIL2 (RECID, MREC, TMP2) VALUES (2, 1, 'AAA2');
INSERT INTO TESTDETAIL2 (RECID, MREC, TMP2) VALUES (3, 1, 'AAA3');
INSERT INTO TESTDETAIL2 (RECID, MREC, TMP2) VALUES (4, 2, 'BB1');
INSERT INTO TESTDETAIL2 (RECID, MREC, TMP2) VALUES (5, 2, 'BB2');
COMMIT;