I have an Sql Query. It does not have any compilation error but in runtime it shows
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
SELECT a.UserID FROM USERGROUPS a WHERE a.GroupID IN
(CASE WHEN @group_id IS NULL THEN (select groupid from usergroups) ELSE
CASE WHEN @group_id=0 THEN (select groupid from usergroups where userid = @userid)ELSE
@group_id END END )
Thanks in advance.
Try this instead: