I know I can't return multiple values with the Case statement but this is the best way I can explain what I want to accomplish. I am trying to write a statement where I will return different values based on what is entered in another field. I have something like this currently:
SELECT animal WHERE
CASE
WHEN :textbox is not null
THEN (SELECT animal from animalsTable where animalType = :textbox
ELSE (SELECT plant from plantsTable where plantType = 'edible')
So basically, I want to be able to list all the animals that correspond to what the user types in the textbox, but if they do not enter anything in the textbox, then I want to show them all plants that are edible instead. I almost always going to return multiple values for each value they enter.
For example, if the user types 'dog' then i will return 'dog' and 'wolf'. So this causes a problem since the case statement is boolean. How can I get around this?
Thanks.