I have an Access query that should pull the quantity purchased in a month for a set of items. My join is set to select all items from Analysis, and items from product that match analysis.
SELECT AnalysisItems.Pmid, AnalysisItems.ProductName, Sum(Transactions.TransactionQty)
AS SumOfTransactionQty, Transactions.StoreAccount
FROM AnalysisItems INNER JOIN Transactions ON AnalysisItems.Pmid = Transactions.Pmid
WHERE (((Transactions.TransactionDate) Between #4/1/2011# And #4/30/2011#)
AND StoreAccount = 964290)
GROUP BY AnalysisItems.Pmid, AnalysisItems.ProductName, Transactions.StoreAccount
ORDER BY AnalysisItems.ProductName;
I want to see all 78 analysis items, whether they have a quantity value or not. This only returns items that have quantities. It also does not return values that are negative or values between 0 and 1 … it won’t show me 0.50 even though I know there are some decimal values in there. Everything is set to Standard decimal, scale 2
I’ve tried changing to general number and getting rid of the format completely but that doesn’t work either.
So my questions are: What can I try to see the decimal values in my query, and how can I see all the items?
“I want to see all 78 analysis items, whether they have a quantity value or not.”
If that means you want AnalysisItems rows included in the result set even if those items don’t have any matches in Transactions for the month of April and StoreAccount 964290, they will not be included when you place those conditions in the WHERE clause … you’ll only get the rows which match the WHERE clause conditions.
I think you need to use a subquery for Transactions and move the WHERE clause into the subquery. And LEFT JOIN AnalysisItems to the subquery.