我想使用以下语句
DECLARE @MatnrFilter TABLE ( ListValue VARCHAR(50) )
INSERT INTO @MatnrFilter
( ListValue )
VALUES ( '167436' )
INSERT INTO @MatnrFilter
( ListValue )
VALUES ( '167447' )
SELECT *
FROM ios.BaseData_2013
WHERE Materialnummer IN ( CASE WHEN ( ( SELECT TOP 1
ListValue
FROM @MatnrFilter
) IS NULL ) THEN Materialnummer
ELSE ( SELECT *
FROM @MatnrFilter
)
END )
我只想在@MtnrFilter 中有值时进行过滤。在这里我收到错误消息
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
还有另一种方法吗?
坦克安迪