Today, I had to write this article for a long time because of a very strange problem.
- Select * from wlbtest3
- Where (sname, sage) not in (select user_name, user_age from wlbtest4)
- Select * from wlbtest3
- Where (sname | sage) not in (select user_name | user_age from wlbtest4)
Do you think the above two statements have the same effect?
You think that is the same and you are wrong !!! I thought it was the same at first. This is used at work, but the data is always not logical.
Finally let me find this place:
- Select * from wlbtest3
- Where (sname, sage) not in (select user_name, ''from wlbtest4)
What does the above sentence mean? You don't have to guess !!!
It means matching sname, but not matching sage, and the effect is the same as that below.
- Select * from wlbtest3
- Where (sname) not in (select user_name from wlbtest4)
So when the value of user_age is null, unexpected problems will occur... We recommend that you use "|.