Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NULLS to ZEROS in CROSSTAB QUERY

Status
Not open for further replies.

laman

Technical User
Jan 24, 2002
44
0
0
US
Need some help with the followig query. I need to return 0 when nulls occur. Ive tried NZ and IIF and can't seem to get it to work.

TRANSFORM count([master].[ID]) AS CountOfID
SELECT [master].[SECTION], count([master].[ID]) AS [Total Of ID]
FROM master
GROUP BY [master].[SECTION]
PIVOT [master].[CL];

Please Help!
Thanks
 
I found some info on a website, it might help...

Try this and see if it fixes your null problem:

when using the nz you need it to tell nz to default to 0 if it = a null value

Nz([BlahBlah], 0)

maybe something like :

SELECT [master].[SECTION], count([master].[ID]) AS Nz([Total Of ID], 0)

help it helps :)
 
I get a syntax error on left paren after nz.
 
Yored The Man! Worked great, Thanks. I never would have tried that but I did try everything else.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top