Nie w taki sposób, w jaki pisałeś. Możesz zwrócić tylko jedno pole lub wpisać dla IN
do pracy.
Z MSDN (IN
):
test_expression [ NOT ] IN
( subquery | expression [ ,...n ]
)
subquery - Is a subquery that has a result set of one column.
This column must have the same data type as test_expression.
expression[ ,... n ] - Is a list of expressions to test for a match.
All expressions must be of the same type as
test_expression.
Zamiast IN
, możesz użyć JOIN
za pomocą dwóch pól:
SELECT U.*
FROM user U
INNER JOIN userType UT
ON U.code = UT.code
AND U.userType = UT.userType