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 6085971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:41:56+00:00 2026-05-23T11:41:56+00:00

I have a cross tab query and it pulls only the row name if

  • 0

I have a cross tab query and it pulls only the row name if there is data associated with it in the database. For example, if I have three types of musical instruments:

Guitar

Piano 

Drums

Other

My results will show up as:

Guitar        1

Drums         2

It doesn’t list Piano because there is no ID associated with Piano in the DB. I know I can specify columns in the properties menu, i.e. “1, 2, 3, 4, 5” will put columns in the DB for each, regardless of whether or not there is data to populate them.

I am looking for a similar solution for rows. Any ideas?

Also, I need NULL values to show up as 0.

Here’s the actual SQL (forget the instrument example above)

TRANSFORM Count(Research.Patient_ID) AS CountOfPatient_ID
SELECT
  Switch(
    [Age]<22,"21 and under",
    [Age]>=22 And [AGE]<=24,"Between 22 And 24",
    [Age]>=25 And [AGE]<=29,"Between 25 And 29",
    [Age]>=30 And [AGE]<=34,"30-34",
    [Age]>=35 And [AGE]<=39,"35-39",
    [Age]>=40 And [AGE]<=44,"40-44",
    [Age]>44,"Over 44"
  ) AS Age_Range
FROM (Research
  INNER JOIN (
    SELECT ID, DateDiff("yyyy",DOB,Date()) AS AGE FROM Demographics
  ) AS Demographics ON Research.Patient_ID=Demographics.ID)
  INNER JOIN [Letter Status] ON Research.Patient_ID=[Letter Status].Patient_ID
WHERE ((([Letter Status].Letter_Count)=1))
GROUP BY Demographics.AGE, [Letter Status].Letter_Count
PIVOT Research.Site In (1,2,3,4,5,6,7,8,9,10);

In short, I need all of the rows to show up regardless of whether or not there is a value (for some reason the LEFT JOIN isn’t working, so if you can, please use my code to form your answer), and I also need to replace NULL values with 0.

Thanks

  • 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-23T11:41:57+00:00Added an answer on May 23, 2026 at 11:41 am

    I believe this has to do with the way you are joining the instruments table to the IDs table. If you use a left outer join from instruments to IDs, Piano should be included. It would be helpful to see your actual tables and queries though, as your question is kind of vague.

    • 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 tab query that is counting Patient_ID's as the value. Total
I have a cross tab inside a subreport. I need to fetch the grandtotal
I have some data that I've staged in my database as such: RowHeader ColumnHeader
The only thing I found is to cross compile bash . Is there another
Suppressing lines in a cross tab crystal report We currently have a cross tab
Possible Duplicate: MySQL dynamic cross tab I have student_record table ------------------------------------------------------------------- student_id | semester
I have a set of data that needs to be displayed as a crosstab
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

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.