我有以下查询语句:
SELECT *
FROM dbo.tblOrders o
WHERE o.OrderId IN (SELECT [Value] FROM [dbo].[udf_GenerateVarcharTableFromStringList](@OrderId, ','))
AND
@ActiveInactive =
CASE
WHEN 'Active' THEN (o.[orderactivedate] > o.[orderinactivedate])
WHEN 'Inactive' THEN (o.[orderactivedate] < o.[orderinactivedate])
END
这段代码返回:
这返回
An expression of non-boolean type specified in a context where a condition is expected, near 'THEN'.
我该如何让这个代码工作?如果参数是“Active”,那么如何返回符合以下标准的记录?