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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:07:52+00:00 2026-06-16T04:07:52+00:00

I have a database with 2 fileds a date and a string (there are

  • 0

I have a database with 2 fileds a date and a string (there are more fileds but only these to are interesting for this) the string can be empty. Now I want to count how many strings are empty and how many are not.

SELECT 
  `date`, `serial`, count(`serial`) as count 
FROM 
  `updates` 
WHERE 
  `date` BETWEEN '2012-11-25 00:00:00' AND '2012-11-25 23:59:59' 
GROUP BY 
  `serial`

This is my code at the moment. I don’t really know how to aggregate this in a good way.

Greetings
Alex

// EDIT

As Result I want to have:

2012-11-25    NULL        2452
2012-11-25    NOT NULL    3476
  • 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-16T04:07:53+00:00Added an answer on June 16, 2026 at 4:07 am

    If you want to count nulls strings, and not nulls, you could use this:

    SELECT
      `date`,
      count(`serial`) as count_not_nulls,
      count(case when `serial` is null then 1 end) as count_nulls
    FROM `updates`
    WHERE `date` BETWEEN '2012-11-25 00:00:00' AND '2012-11-25 23:59:59'
    GROUP BY `date`
    

    EDIT:

    SELECT `date`, 'NOT NULL', count(`serial`) as count
    FROM `updates`
    WHERE `date` BETWEEN '2012-11-25 00:00:00' AND '2012-11-25 23:59:59'
         AND `serial` is not null
    GROUP BY `date`
    UNION
    SELECT `date`, 'NULL', count(1) as count
    FROM `updates`
    WHERE `date` BETWEEN '2012-11-25 00:00:00' AND '2012-11-25 23:59:59'
          AND `serial` is null
    GROUP BY `date`
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a huge database with rows structured by the fields date, ad, site,
I have DateFirstStarted and DateEnded fields in the database. Date values are recorded as
I have a Database with this fields: Firstname, Lastname, picture. I have a gtk.Label
In my database we have fields where the data is not readable. I now
I have a database full of text fields that look like this: (paragraph of
I have a Database named CarsType.accdb there are four fields in the data base
I have two fields: string date1 = 04/26/10; string date2 = 04/25/10; How can
I want to use a datastructure like this: building string (indexed) date TDate (indexed)
I have a string that needs to be turned into a date attribute to
I have a simple database with two tables: Photo and Tag . There is

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.