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

Desperate! Null query results in aggregate query

Status
Not open for further replies.

ClifCamp

Technical User
Jul 24, 2001
23
US
I have an aggregate query which brings together results from six separate queries.The six sub-queries are based on a table which changes every month. They calculate a % based on categories. The categories may come and go throughout the year, with the result being that one or more of the sub-queries may return data in one month but not the next. The main query puts all these percentages together in a report. The problem I am having is that if one of the sub-queries is empty, then the entire main query comes back empty. I would like for the main query to return the percentages for the categories where there is data and ignore the empty sub-queries. I have tried 'Nz' and 'IIf' in different ways but with no success. Can anyone help?
Thanks!
 
Post 1 or 2 of the category queries and the final query that brings them all together. You may be able to do everything with one query.
 
My guess is that you are using inner joins in the query. If you have one query that is empty, this will result in all the queries being empty. You would have to use Outer Joins to always get a result.

Hope this helps.

OnTheFly
 
OnTheFly - Outer joins would solve the problem if there was one subquery which always had data. Otherwise you'd still run into the problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top