Bukan cara Anda memposting. Anda hanya dapat mengembalikan satu bidang atau jenis untuk IN
untuk bekerja.
Dari 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.
Alih-alih IN
, Anda dapat menggunakan JOIN
menggunakan dua bidang:
SELECT U.*
FROM user U
INNER JOIN userType UT
ON U.code = UT.code
AND U.userType = UT.userType