Cross tab query

rowfei

Registered User.
Local time
Today, 06:26
Joined
Feb 8, 2012
Messages
13
I have a cross tab query with the codes below:

TRANSFORM Sum(OrdersDetail.Quantity) AS SumOfQuantity
SELECT OrdersDetail.[Product Name]
FROM OrdersDetail
GROUP BY OrdersDetail.[Product Name]
PIVOT OrdersDetail.Sold;

Since some product never been sold, that's why it shows blank. What codes need to be added in order to display those blank field to "0."

Thanks,
 
Not at all sure it will work, but you could try this:
Code:
TRANSFORM Sum([COLOR=red]Nz([/COLOR]OrdersDetail.Quantity[COLOR=red],"0")[/COLOR][COLOR=black])[/COLOR] AS SumOfQuantity
SELECT OrdersDetail.[Product Name]
FROM OrdersDetail
GROUP BY OrdersDetail.[Product Name]
PIVOT OrdersDetail.Sold;
 
Just tried, still shows the blank field instead of 0. Any more suggestion?
 
TRANSFORM Nz(Sum(OrdersDetail.Quantity),"0") AS SumOfQuantity
SELECT OrdersDetail.[Product Name]
FROM OrdersDetail
GROUP BY OrdersDetail.[Product Name]
PIVOT OrdersDetail.Sold;
 

Users who are viewing this thread

Back
Top Bottom