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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

One-to-many Relationship Query Problem

Status
Not open for further replies.

Bill6868

Technical User
Mar 20, 2007
96
US
I have a table tracking state legislative issues (tbl1). An ID number is my primary key with no duplicates allowed. I have another table (tbl2) that logs our many comments about the legislative bill as it progresses thru the legislative process in a memo field with the legislative ID number indexed – duplicates allowed. We have one legislative issue (tbl1) with many comments (tbl2).

My problem lies with my query – I have the two tables in my query linked by the ID number. As long as I have comments entered in tbl2 the query will produce a result. But if I have no comments (or records) entered in tbl2 the query comes up null – it does not display the data in tbl1 if the is no related ID number in tbl2.

How can I get the query to display the data in tbl1 when there is no related data (comments) in tbl2?

I was hoping to avoid creating a lengthy macro that would create a make table and append the data there temporarily just to run the report. Is there a better way – or any way?

Thanks for any advice.


 



Hi,

Use an outer join, keeping all rows from tbl1 and only those that match from tbl2

Skip,

[glasses] [red][/red]
[tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top