Sangeeth878787 (3/3/2015)
hi,I want to check if column 1 = 'ab' then I need all the other columns (column2, column3 ) values need to be zero
I tried doing this
select case when column1 = 'ab' then column2 = 0
when column1 = 'ab' then column3 = 0
But this is not the write way doing it, Can one give any inputs, please.
How about a create table statement, some sample data and sample expected outputs? From what you wrote you want your statement is correct I think, although it is missing an ELSE for when column1 is NOT = 'ab'.
Best,
Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru on googles mail service