Ne tak, jak jste zveřejnili. Pro IN
můžete vrátit pouze jedno pole nebo typ do práce.
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.
Místo IN
, můžete použít JOIN
pomocí dvou polí:
SELECT U.*
FROM user U
INNER JOIN userType UT
ON U.code = UT.code
AND U.userType = UT.userType