Given the following:


SELECT
R.TEAMING_AGREEMENT_ID,
R.ROUTE_GROUP_ID,
B.BUSINESS_NAME,
T.OPPORTUNITY_ID,
D.DOCUMENT_NAME,
D.DOCUMENT_EXTENSION
FROM
TEAMING_AGREEMENT_ROUTING R
INNER JOIN TEAMING_AGREEMENT T
  ON (R.TEAMING_AGREEMENT_ID = T.TEAMING_AGREEMENT_ID)
INNER JOIN COMMUNITY_BUSINESS B
  ON (T.COMMUNITY_BUSINESS_ID = B.COMMUNITY_BUSINESS_ID)
INNER JOIN TEAMING_AGREEMENT_TYPE TAT
  ON (T.TEAMING_AGREEMENT_TYPE_ID = TAT.TEAMING_AGREEMENT_TYPE_ID)
INNER JOIN TEAMING_AGREEMENT_DOCUMENT D
  ON (T.TEAMING_AGREEMENT_ID = D.TEAMING_AGREEMENT_ID)
WHERE
T.OPPORTUNITY_ID = 33
GROUP BY
B.BUSINESS_NAME,
R.TEAMING_AGREEMENT_ID,
R.ROUTE_GROUP_ID,
T.OPPORTUNITY_ID,
D.DOCUMENT_NAME,
D.DOCUMENT_EXTENSION


If I need to get two of documents from the TEAMING_AGREEMENT_DOCUMENT
table (different types: DOC_TYPE = 1 and DOC_TYPE =2), how can I do this
and get the desired number of records returned. If I remove the joined
in TEAMING_AGREEMENT_DOCUMENT table I return 5 records, which is
correct, but when I try and get the two documents associated I return 10
records. Is there anyway to qualify the selection of the documents? I
hope this makes sense.... grouping? sub query?


Thanks!


Mike
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to