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

Disappearing info

Status
Not open for further replies.

whiffy

Technical User
Jul 3, 2001
27
0
0
GB
Hi,

I should know this. But I don't. obviously.
Can anyone help me?

I have a table called tbl_customerquery which, amongst others, has three foreign keys queryconid, querycatid and querytypeid which link to the tables querycon, querycat and querytype respectively.

The thing is there is only one entry in querycon so when I run a query based on the above tables I only get one row returned.

Is there a way of outputting all 54 rows that should be returned that have a "0" in the "querycon" table?

Did any of that make sense?
It didn't to me.
 
Here it is, as generated by Access using Design View. (I'm no good with SQL).
It looks rather more complicated than it needs to be I think.

SELECT DISTINCT tbl_CustomerQuery.queryId, tbl_QueryCat.QueryCat, tbl_QueryType.QueryType, tbl_QueryCon.QueryCon
FROM tbl_QueryType INNER JOIN (tbl_QueryCon INNER JOIN (tbl_CustomerQuery INNER JOIN tbl_QueryCat ON tbl_CustomerQuery.QueryCatID = tbl_QueryCat.QueryCatID) ON tbl_QueryCon.QueryConID = tbl_CustomerQuery.QueryConID) ON tbl_QueryType.QueryTypeID = tbl_CustomerQuery.QueryTypeID
GROUP BY tbl_CustomerQuery.queryId, tbl_QueryCat.QueryCat, tbl_QueryType.QueryType, tbl_QueryCon.QueryCon, tbl_QueryType.QueryTypeID
HAVING (((tbl_QueryType.QueryTypeID)>1));
 
It's ok. I worked it out. I needed a right join.
Thanks for responding so quickly.

Cheers,

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top