I have a variable @variable 1 [bit]
which tells me either to exclude or not certain data (based on a different value) from a select statement.
Simple example I have a table (plants
) with 2 columns :
Name_of_the_plant, numbers
I have a report in which the user should be able to declare a value @WithoutTrees
and I should be able to present the result without the trees, based on their names(for which I have a nomenclature).
I want to be able to run the select query based in two ways based on the variable WithoutTrees
.
- When the bit value is 0:
SELECT * FROM Plants
- When the bit value is 1:
SELECT * FROM Plants where Name_of_the_plant not in ('Oak', 'Pine')