CASE IN SQL SERVER WHERE CLAUSE -
i need query below contains case in clause
declare @billback int set @billback=1 select coloumn1, coloumn2, coloumn3, [project_id] [purchase_details] (case when @billback = 0 [project_id] = 0 when @billback = 1 [project_id] != 0 end or [project_id] in (1, 2, 3) )
above query gives error, please me in different way
based on positioning of case ... when
, appears trying following:
select colomn1, column2, column3, [project_id] [purchase_details] [project_id] in (1,2,3) or ((@billback = 0 , [project_id] = 0) or (@billback = 1 , [project_id] <> 0));