Not all Data in Query

P

phuser

The query is generated by 3 tables, 1st one is Main that contains invoice
numbers, unit # and is the one to many, the other 2 contain the details of
parts & labor, for those invoices. I want to create a query so that all the
total of the invoices will be generated for a subform, but it only gives me
the invoices that contain both parts & labor, if an invoice has no parts but
labor and visa versa that invoice does not show up in the query. Help!
 
J

John Spencer

The solution may be as simple as changing the joins in your query.
Double-click on the join line(s) and select the type of join that makes
sense for your situation.

If that doesn't work or you can't figure it out with some experimentation
then, please copy and post the SQL of your query.

(Possibly unneeded instructions follow)
Open the query
Select View:Sql from the Menu
Select all the text
Copy it
Paste it into the message
 
P

phuser

SELECT Workorders.Date, Workorders.Unit, Workorders.PurchaseOrderNumber,
Workorders.GST, Workorders.PST, Workorders.[MISC Charges], Sum([Workorder
Labor].SubTotalLabor) AS Labor, Sum([Workorder Parts].UnitPrice) AS Parts,
[Parts]+[Labor]+[GST]+[PST]+[Misc Charges] AS Total
FROM (Workorders RIGHT JOIN [Workorder Labor] ON Workorders.WorkorderID =
[Workorder Labor].WorkorderID) RIGHT JOIN [Workorder Parts] ON
Workorders.WorkorderID = [Workorder Parts].WorkorderID
GROUP BY Workorders.Date, Workorders.Unit, Workorders.PurchaseOrderNumber,
Workorders.GST, Workorders.PST, Workorders.[MISC Charges],
[Parts]+[Labor]+[GST]+[PST]+[Misc Charges];
 
P

phuser

Never mind I did it, once I changed the joins it worked, thanks so much for
the insight!!
 

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