我需要在内部写case语句,条件类似于。
"If color equel to 'RED' then return all the flowers including red"
else "return all flowers which are not RED"
我需要在where子句中包含这个语句,我的where语句看起来像这样
Select Plant, leafs, places
from dbo.tblplant, dbo.tblflower,dbo.tblplaces
where dbo.tblplant = ID and
dbo.tblplaces = PLACE and
dbo.tblflower = REDCOLOR.
而不是redcolor我需要修改,以便查询应该返回所有花朵,如果它的红色,否则它应该排除红色,并返回休息。
答案 0 :(得分:4)
where @colorParameter = 'RED'
or ( @colorParameter <> 'RED' and tblplant.color <> 'RED')