MarcieFess
Registered User.
- Local time
- Today, 17:12
- Joined
- Oct 25, 2012
- Messages
- 107
I need help modifying a query I didn't write...or, if it's better that I write a query using the results of this query, I'm open to that.
I have a query:
SELECT SP.[Store Product Key], (([P].[Package]*[P].[Size]*[SP].[Cases])/[P].[ConversionRate]) AS QOH
FROM Product AS P INNER JOIN [Store Products] AS SP ON P.UPC = SP.UPC;
I believe the SP and P are aliases that the person who wrote the query created because I mistakenly used spaces in the field names when I created the tables.
This is a simple query that returns the Quantity on Hand for each product in the Store Products table.
I have to run a report (it's already created) that will list each product individually, sorted by aisle number in the store.
For another report (this has to be printed by store, and an individual store must be able to be reported on demand...maybe that's another question), I have to total the QOH for each Hazard Class.
Here's what I have so far...and it's not running. I get an error "You tried to execut a query that does not include the specified expression 'Store Name' as part of an aggregate function."
SELECT StoreProductsQuery.[Store Name], [Hazard Class].[Hazard Class], QuantityOnHandQuery.QOH, Sum([QuantityOnHandQuery].[QOH]) AS SumQOH
FROM QuantityOnHandQuery, [Hazard Class], StoreProductsQuery, HMIRFReportQuery
WHERE (((StoreProductsQuery.[Store Name])="Riverpark") AND (([Hazard Class].[Hazard Class])="COMBUSTIBLE LIQUIDS II"));
Basically I need to be able to total on each Hazard Class...I created this query specifically for Combustible Liquids II but if I can get 1 query to do it all so they don't have to run 100 different queries, that would be great. I also tried to get the query to run just for the Riverpark store, but the fewer changes this company has to make to be able to run the required reports, the better.
Someone please help???? :banghead:
I have a query:
SELECT SP.[Store Product Key], (([P].[Package]*[P].[Size]*[SP].[Cases])/[P].[ConversionRate]) AS QOH
FROM Product AS P INNER JOIN [Store Products] AS SP ON P.UPC = SP.UPC;
I believe the SP and P are aliases that the person who wrote the query created because I mistakenly used spaces in the field names when I created the tables.
This is a simple query that returns the Quantity on Hand for each product in the Store Products table.
I have to run a report (it's already created) that will list each product individually, sorted by aisle number in the store.
For another report (this has to be printed by store, and an individual store must be able to be reported on demand...maybe that's another question), I have to total the QOH for each Hazard Class.
Here's what I have so far...and it's not running. I get an error "You tried to execut a query that does not include the specified expression 'Store Name' as part of an aggregate function."
SELECT StoreProductsQuery.[Store Name], [Hazard Class].[Hazard Class], QuantityOnHandQuery.QOH, Sum([QuantityOnHandQuery].[QOH]) AS SumQOH
FROM QuantityOnHandQuery, [Hazard Class], StoreProductsQuery, HMIRFReportQuery
WHERE (((StoreProductsQuery.[Store Name])="Riverpark") AND (([Hazard Class].[Hazard Class])="COMBUSTIBLE LIQUIDS II"));
Basically I need to be able to total on each Hazard Class...I created this query specifically for Combustible Liquids II but if I can get 1 query to do it all so they don't have to run 100 different queries, that would be great. I also tried to get the query to run just for the Riverpark store, but the fewer changes this company has to make to be able to run the required reports, the better.
Someone please help???? :banghead: