TechAid24

Your Technical Consultant

SQL: Can you use multiple columns for NOT IN

Posted on by Selim Ahmed 1 minute read

In this post, we want to discuss a nice function to use multiple columns for NOT IN in SQL Server. Before we get started, if you want to know about random number generators, please go through the following article: Random Number Generator Script – SQL Query.

Let’s Start. I want to select all records from a table FRIEND where the values in columns f1 and f2 has no matching tuple for the columns l1 and l2 in table LIKES.

SELECT * FROM FRIEND F
WHERE not exists
(
    SELECT 1 FROM LIKES L WHERE F.f1 = L.l1 and F.f2 = L.l2
)
Can you use multiple columns for NOT IN

Tags:

Selim Ahmed

Thank you for visiting my personal blog. I’m Selim Ahmed, a tech-savvy who loves to learn a new technology every day. Innovation, research, and development is my daily activities. I love to work in a place where I can learn, innovate, and develop new things.Please feel free to reach me on any comments and feedback you have. I would be more than glad to listen and reply.

Leave a Reply

Your email address will not be published. Required fields are marked *