Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Joining Queries with Multiple Data Links

Status
Not open for further replies.

rbanister

Programmer
Dec 21, 2007
1
0
0
US
I have a report with 2 queries: Q_FIRMS and Q_1. Q_FIRMS is the parent, uses LICENSE_NO as a primary key, and has a G_LIC_NO group. Q_1 returns products for each firm, and has LICENSE_NO as a foreign key. A data link attaches G_LIC_NO.LICENSE_NO to Q_1.LICENSE_NO.

There is a new field, ARCHIVE_LICENSE_NO, in Q_FIRMS. Q_1.LICENSE_NO must use this as a foreign key as well. It allows the query to return products for previous license numbers. This would be fairly straightforward as a query:

SELECT DISTINCT *
FROM firms f, products p
WHERE (
f.license_no = p.license_no
OR f.archive_license_no = p.license_no
)

How would I add a second data link to accomplish this OR functionality? Is a data link the right solution?

Thanks,

Richard
 
Remove the FK link and create a link that is simply group-to-group. To do this, select the link tool then drag the group header from Q_FIRMS to the header of the Q_1 group.

In your query for Q_1 you can then wite it as
Code:
SELECT DISTINCT *
FROM firms f, products p
WHERE  f.license_no = :license_no
OR f.archive_license_no = :license_no
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top