SQL Server IN Operator
The IN Operator is used in a Where clause of the SQL Statement to retrieve the records that matches to a list of values.
The IN operator allows you to specify list of values in a WHERE clause for Matching Criteria Syntax:
SELECT Column_name(s) FROM Table_name
WHERE Column_name IN (Value1,Value2,...)
Example :
Suppose we have EMP Table as follows :
Criteria :
If we want to select the Employees belongs to the Dept 1 and 2 , use the below query :
Select *from EMP E WHERE E.Dept_Id IN(1,2)
Result :
Thanks,TAMATAM
The IN Operator is used in a Where clause of the SQL Statement to retrieve the records that matches to a list of values.
The IN operator allows you to specify list of values in a WHERE clause for Matching Criteria Syntax:
SELECT Column_name(s) FROM Table_name
WHERE Column_name IN (Value1,Value2,...)
Example :
Suppose we have EMP Table as follows :
Criteria :
If we want to select the Employees belongs to the Dept 1 and 2 , use the below query :
Select *from EMP E WHERE E.Dept_Id IN(1,2)
Thanks,TAMATAM
No comments:
Post a Comment
Hi User, Thank You for visiting My Blog. Please post your genuine Feedback or comments only related to this Blog Posts. Please do not post any Spam comments or Advertising kind of comments which will be Ignored.