PDA

View Full Version : Anyway to return 0 in a Crosstab Query?



prabhafriend
01-10-2011, 08:23 AM
Assume, There are two persons in a table. Person1, Person2. Person1 is having 5 apples and Person2 is having 3 Mangoes in respective records:

Name Fruit Unit
Person1 Apple 5
Person2 Mango 3

If we do a transform having Name as Row and Fruit as Column and Unit as value. We will be having a list of Persons having n of Apple and n of Mango.

Name Apple Mango
Person1 5
Person2 3

So far, So Good.
Here comes the problem. I need to display 0 instead of blanks. Like this:
Name Apple Mango
Person1 5 0
Person2 0 3

For your kind attention, I know I can easily make this with another select query. But I'm very curious to know It's there any property or something of the query which will display 0 instead of blanks. Otherwise tell me a way to make it possible in a single crosstab query. Thank You.

stanl
01-18-2011, 05:07 AM
Having not seen your TRANSFORM... code, I suspect you can employ the NZ() function to get 0 Values. Just .02 Stan