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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:15:01+00:00 2026-06-15T15:15:01+00:00

I am trying to query the MySQL database to return some results. For e.g.

  • 0

I am trying to query the MySQL database to return some results. For e.g. I have a HTML form where user can enter some search values and can execute it. This form contains two fields: Body and Query String (these are appropriate fields with my database table).

I am executing the query like this:

select count(*) from Message;

The result is: 7280

If I execute the query like this:

select count(*) from Message where body like '%%';

The result is: 7280

The body does not have any null values.

But if I add another empty like into the query:

select count(*) from Message where body like '%%' and queryString like '%%';

There result is: 3353.

My queryString column contains some null values, which I am guessing is causing this. What I would like that query to return is the same count of results (7280) and ignore those null values. How to achieve this using MySQL?

  • 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-15T15:15:02+00:00Added an answer on June 15, 2026 at 3:15 pm

    You can make use of IFNULL function :

    select count(*) from Message where body like '%%' and IFNULL(queryString, " ") like '%%';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to query my database to get some results in Chinese and Japanese
I'm having some issues trying to insert a query into the database. I have
I'm trying to query a MySQL database using an array but I'm having trouble!
I'm trying to do a MySQL Query that adds information to a database in
I am trying to reconstruct a database query I created for MySQL in Microsoft
I have folowing MYsql Query And Trying to right outer join but unable to
I trying to create a MySql Query from the $_POST values trouble is i
i'm trying the following MySQL query to fetch some data: SELECT m.*, t.* FROM
I'm trying to cache some results retrieved from database using Yii framework 1.1.12. Here
I am trying to return a result set from a MySQL database table of

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.