it's just an example. (My point is how can I do when I'm getting more then one result in the CASE statement):
SELECT
,@PARAM AS id
,Date=(
SELECT distinct CASE
WHEN P.DATE1 <= 05 and P.DATE2 <= 10
THEN 'X'
WHEN P.DATE1 > 05 and P.DATE2 <= 10
THEN 'Y
WHEN P.DATE2 > 10
THEN 'Z'
END )
FROM Prod AS P
The error is as follows:
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression**