Skip to content Skip to sidebar Skip to footer

Where Something In (case When Statement)?

I want to write a 'select clause' according to conditional condition! bu I have error: Msg 512, Level 16, State 1, Line 2 Subquery returned more than 1 value. This is not permitte

Solution 1:

why use a case? can't you just do

where (@Level = 1 and ExpenseId in (select id from bdg_expenses where parentid = 1)) or
      (@Level <> 1 and ExpenseId in (select id from bdg_expenses where id = 1))

Post a Comment for "Where Something In (case When Statement)?"