Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6154387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:15:17+00:00 2026-05-23T20:15:17+00:00

I have a cross tab query that is counting Patient_ID’s as the value. Total

  • 0

I have a cross tab query that is counting Patient_ID’s as the value.

Total = Nz(Count(Research.Patient_ID))+0

I have also tried:

Total = Nz(Count(Research.Patient_ID)

and….

Total = Nz(Count(Research.Patient_ID, 0)

etc. Nz() only works if at least one value is not null. However, if all of them are null, instead of seeing all 0’s, I see nothing.

This is problematic because I am using these queries as subqueries. The main query takes the values from this one (and others like it) and adds them together. Unfortunately, if one of the subqueries is entirely null, then the sum actually turns up null, regardless of whether or not should be.

For example:

subquery1: Nz(Count(Research.Patient_ID))+0

subquery2: Nz(Count(Research.All_ID))+0

mainquery: subquery1 + subquery2


if subquery1 = 4, and subquery2 = Null...

mainquery = subquery1 + subquery2
mainquery = Null

when really…

mainquery = 4

Please help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:15:18+00:00Added an answer on May 23, 2026 at 8:15 pm

    In this query, the main query produces the sum of counts determined in two subqueries. Is this what you’re after?

    SELECT
        Nz(s1.CountOfPatient_ID,0) + Nz(s2.CountOfAll_ID,0)
    FROM
        [SELECT Count(Patient_ID) AS CountOfPatient_ID FROM Research]. AS s1,
        [SELECT Count(All_ID) AS CountOfAll_ID FROM Research]. AS s2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do i count null values while making cross tab query? I have a
I have a cross platform program that runs on Windows, Linux and Macintosh. My
I have some cross platform DNS client code that I use for doing end
I have a web page that uses cross page posting to post to a
I have a cross tab inside a subreport. I need to fetch the grandtotal
I am stuck in a problem that is to create cross tab between two
Possible Duplicate: MySQL dynamic cross tab I have student_record table ------------------------------------------------------------------- student_id | semester
How can I get the total number of Granny Smith apples? I have tried
Suppressing lines in a cross tab crystal report We currently have a cross tab
I have a query like this: select to_date(to_char(registime, 'YYYY-MM'),'YYYY-MM') as dt,count(id) as total_call from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.