Help with Query

G

Guest

I am a new Access user and I am an in the early learning stages.
I have multiple tables, one of which has customer order information in it.
I will provide the SQL of what I currently have, but this is what I want to
do:
I want to have a seperate field for each weekly count of invoices and sum of
qtys by item id.

Material Invoices Units
2NE65 2 2
4AK88 2 4
4X577 4 12

where I want it to report like this:

Material Invoices Units Invoices Units Invoices Units
12234 2 2
12334 2 4
11134 4 12

....where each group of Invoices/Units is broken up into a weekly bucket. I
do not know how this can be done. If someone could please look at my SQL and
give me a hand or maybe a push in the right direction. Here it is:

SELECT [Fastener Invoice Data].Plant, BranchTable.[Buy Loc], [Fastener
Invoice Data].Material, Count([Fastener Invoice Data].Reference) AS Invoices,
Sum([Fastener Invoice Data].Qty) AS Units, CPIR_MTL_BASE_040406.SalesStatus
FROM [Fastener Invoice Data (field deployed)] INNER JOIN (((([Fastener
Invoice Data] INNER JOIN CPIR_MTL_BASE_040406 ON [Fastener Invoice
Data].Material = CPIR_MTL_BASE_040406.Material) INNER JOIN BranchTable ON
[Fastener Invoice Data].Plant = BranchTable.Plnt) INNER JOIN [Fastener
List_Field] ON [Fastener Invoice Data].Material = [Fastener
List_Field].ItemID) INNER JOIN [Branch/District/FIS/BIRM] ON [Fastener
Invoice Data].Plant = [Branch/District/FIS/BIRM].Branch) ON ([Fastener
Invoice Data (field deployed)].Material = CPIR_MTL_BASE_040406.Material) AND
([Fastener Invoice Data (field deployed)].Plant = BranchTable.Plnt) AND
([Fastener Invoice Data (field deployed)].Material = [Fastener
List_Field].ItemID) AND ([Fastener Invoice Data (field deployed)].Plant =
[Branch/District/FIS/BIRM].Branch)
GROUP BY [Fastener Invoice Data].Plant, BranchTable.[Buy Loc], [Fastener
Invoice Data].Material, CPIR_MTL_BASE_040406.SalesStatus,
[Branch/District/FIS/BIRM].District, CPIR_MTL_BASE_040406.PMCode,
CPIR_MTL_BASE_040406.VendorName, CPIR_MTL_BASE_040406.PurchGrp
HAVING (((Count([Fastener Invoice Data].Reference))>1))
ORDER BY [Fastener Invoice Data].Plant;

Thanks in advance for any help you could provide.
 
G

Guest

I forgot, my table "Fastener Invoice Data" does have a date field called
"Postg Date"
 

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