Thanks for the reply but it didn't work as written.here is some sample code. I should have supplied this before.declare @owed varcharselect @owed='yes'select *from(select '1' as id, 200.00 as t_tamt, 0.00 as t_lbal union allselect 2,250, 250 union allselect 3,300, -100 union allselect 4,350, 0 union allselect 5,400,400) tmp
Now if @owed is 'yes' then I want to exclude all the records where there is a 0 in the t_lbal field.However if @owed is 'no' then show all the recordsI got 0 results with WHERE (t_lbal<>0 and @owed='yes') or @owed='no'CardGunner