What kind of query may I use to....

A

AndyEduardo

Thanks for your attention.

My description.

The products has been classified in many categories. For exampl
Non-Ferrous, Ferrous, Non-Metalic, etc

Table SalesPlan
PlanOfCategory as Double
Month as Integer
CategoryID as Integer

Table Categories
CategoryID as Integer
CategoryName as Text

Table Products
ProductID as Autoincrement
ProductName as Text
CategoryID as Integer

Table Sales
InvoiceNumber as Autoincrement
ProductID as Integer
Quantity as Double

I want this:

I need to do a query to show the relation between Sales and Plan, bot
by categories.
But I need when the Sales of some categories are cero, then the quer
shows the Plan of this categories too, even though the Sales field i
empty

Thanks for help m
 
J

John Welch

Andy, use a LEFT join between the two tables to show all plans, even though
there are no sales. (highlight the join line, right click, choose "show all
records from table plans, and only those from table sales with matching
records." )

Then use sum() and group by to get what you want. You might also read about
crosstab queries, since they might be useful to you here.
good luck
-John
 

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

Top