Query display info even if no $

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am working with store sales data. Not every store sells every product.
How can I get a query to list all stores and put a zero in a product field if
there are no sales, rather then only listing the stores that sell all the
items?
 
Use the "product table as your main table in the query and don't put any
criteria under the sales data. Also include your "store" table. Make sure
your join pulls all from both tables.

Without knowing more about your structure it would be hard to give you a
more detailed answer.
 
You need to create a LEFT JOIN between Stores and the sales data.

In the graphical query builder, select the line that joins the two tables,
right click on it and choose the option that selects everything from the
Stores table, regardless of whether there's a match in the sales data.

When you do that, you'll end up with a row that has a Null value for those
stores that don't have any sales. Use the Nz function to convert the Null to
a zero.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top