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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:39:40+00:00 2026-06-10T23:39:40+00:00

I am making the following select query : select date(al.created_on) date, a.name appname, u.regcode

  • 0

I am making the following select query :

select date(al.created_on) date, a.name appname, u.regcode rc, u.email_address ea from audit_logs al 
JOIN users u ON al.user_id = u.id
JOIN applications a ON al.application_id = a.id
group by date, appname, ea
order by date DESC, appname, ea;

and get over 900 results where a lot of the values for “u.regcode rc” are NULL.

I also need to filter a specific regcode out and change the query to:

select date(al.created_on) date, a.name appname, u.regcode rc, u.email_address ea from audit_logs al 
JOIN users u ON al.user_id = u.id
JOIN applications a ON al.application_id = a.id
WHERE u.regcode != '9999'
group by date, appname, ea
order by date DESC, appname, ea;

But now all the results where the u.regcode was NULL is being filtered out too.
Even if I change the WHERE clausel to ” WHERE u.regcode = NULL “, the NULL values are being filtered out and I get nothing at all.

Is there a way where I can just filter out specific values of the u.regcode-column without losing the lines with the NULL values?

  • 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-10T23:39:42+00:00Added an answer on June 10, 2026 at 11:39 pm

    All comparisons to null evaluate to false (or, more precisely, they evaluate to unknown, which means they do not evaluate to true, so that means that they act like false but any other boolean operations using those expressions also evaluate to unknown), including equality and inequality comparisons. This is one of the trickier aspects of SQL to grasp, but fundamentally null represents a missing value. As far as the SQL server is concerned, there may be a value, but it doesn’t have it, and thus the value is unknown. Because it doesn’t know what the value is, it doesn’t know if it’s equal to, less than, or greater than any other value.

    To compare a value to null, you need to use either is null or is not null.

    So, for your query, you’d use

    where u.regcode != 9999 or u.regcode is null
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making an reservation system. The following query Reservatie r = (from res in
In Perl I'm making an SQL query akin to the following: SELECT `id`, `title`,
I have to perform the following SQL query: select answer_nbr, count(distinct user_nbr) from tpoll_answer
How do I optimize the following SQL query for performance? select * from Employee
Any tips on making the following option elements draggable? <select id=expenseSelect multiple=multiple style=height:200px> <option
I been following a tutorial for making my webpage css 100% height from this
I'm making a newsfeed type of thing and I want to select from multiple
In MySQL I wrote the following query. Making it reselect all that data again
I am using the following SQL query in MySQL. SELECT SUBSTRING(invoices.dateCreated, 1, 7) AS
The following fails: $result = mysql_query(SELECT * FROM Tasks WHERE UserID = '$_SESSION['userID']'); I

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.