Problem with null value query for Mysql not in

Source: Internet
Author: User

One problem that is found today in MySQL's not-in use is roughly:

Select *  from where  not inch (Select from B).

found that the query results are 0 records anyway. Later found that the query result set returned in B has a null value, looked up the data only to know that MySQL does not inside if there is a null value, will return 0 records.

To solve this problem, you need to turn select FID from B into

Select  from where  is  not NULL

This is also the problem in other databases, because the processing of not is problematic. Further details, as follows:

Select *  from where  not inch (1,2,null )

Then there is no record return, because there is a null value, when compared with the ID and NULL, it will return false, so a record will not return, so you have to change to the following:

Select *  from where  not inch (Selectfromwhere bid   is  not NULL

Problem with null value query for Mysql not in

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.