0

我需要在内部写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 我需要以这样的方式进行修改,即查询应该返回所有红色的花朵,否则它应该排除红色的一个并返回休息。

4

1 回答 1

4
where  @colorParameter = 'RED' 
       or ( @colorParameter <> 'RED' and tblplant.color <> 'RED')
于 2013-08-21T10:09:04.640 回答