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

  • Home
  • SEARCH
  • 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 8228199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:23:03+00:00 2026-06-07T16:23:03+00:00

I am creating a fairly simple Access database for work and I am stuck

  • 0

I am creating a fairly simple Access database for work and I am stuck on this one SQL statement:

I have a table that contains Handsets and the Site Ids they are assigned to. What I want to do is query the table to give me the number of NULL entities in one column and another column that displays the number of handsets assigned to X site id.

I can get the count of the NULL entities very easily but to get both results in the one statement is beyond me.

This is what I have so far:

SELECT Handset_Type, COUNT(*) as "Number of null handsets"
FROM tbl_Handsets
WHERE Handset_Site_Id is Null
GROUP BY Handset_Type;

So now I have the count of null handsets but now I need the count of handsets assigned to X as well.

Something like below should be the output:

HANDSET     ||| NULL |||   X
handset 1   |||   50 |||   5
handset 2   |||   20 |||  10

Can anyone please 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-06-07T16:23:04+00:00Added an answer on June 7, 2026 at 4:23 pm

    You can use Access’s IIF() function to conditionally aggregate:

    SELECT   handset_type,
             COUNT(IIF(handset_site_id IS NULL, 1, NULL)) AS nullcount,
             COUNT(IIF(handset_site_id = X, 1, NULL)) AS X
    FROM     tbl_handsets
    GROUP BY handset_type
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a fairly simple database that I inherited. For the purposes of this
We have a fairly simple program that's used for creating backups. I'm attempting to
I have a fairly simple console app that monitors an exchange mailbox, picks particular
This is a fairly simple question, but it's one I can't find a firm
I am fairly familiar with creating simple custom controls, but I haven't had this
I am creating a fairly simple Java client that connects to my account and
I have a fairly simple table requestparams ( requestid varchar(64) NOT NULL, requestString text,
I have a fairly simple system, and for the purposes of this question there
I'm working on a project creating a fairly simple one-to-many host-to-slave network using a
This should be fairly simple question. I'm using DocX library to create new word

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.