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

Displaying multiple tables in one query

Status
Not open for further replies.

JeffGMACI

Technical User
Jun 16, 2003
12
US
I've set up several tables as follows:

tblTV
AutoNumber (PK)
AgentNumber (FK)
TVBudget ($)

tblRadio
AutoNumber (PK)
AgentNumber (FK)
RadioBudget

tblMaster
AgentNumber (PK)
Agent Name


What I'd like to do is make a query that displays all the agent numbers that have a TVBudget OR a RadioBudget value. There are a lot of AgentNumbers without an associated radio budget or TV budget, and some with both, and some with one, etc. I'm having trouble structuring my query to display both. Is there a way I can make agents with a TV budget but no radio budget have a null value for radio instead of excluding the whole agency in the query? I'm just not sure how to structure this. Thanks for the help!

Jeff
 
select m.agentnumber, m.agentname, r.radiobudget, t.tvbudget
from tblTV t, tblRadio r, tblmaster m
where m.agentnumber = r.agentnumber
and m.agentnumber = t.agentnumber
and (r.radiobudget is not null or t.tvbudget is not null)

Dodge20
 
Dodge, When I do this, it limits my query to only the Agent numbers in the master table that have TV data AND radio data, not one or the other. Is there a way around this?

Jeff
 
Some have TV only, some have radio only, and some have both...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top