简单查询条件SQL
一个表里有三个字段,f1,f2,f3 
 有两个查询值,分别是v1,v2 
 现在情况是这样的 
 我要根据f1的值确定查询条件 
 当f1值为1的时候就用f2=v1 
 当f1值为9的时候就用f3   like    '%v2% ' 
 请教高手这样的Sql怎么写呢?? 
 先谢谢啦 
------解决方案--------------------select * from 表  
 where f2=(case when f1=1 then  'v1 ' else f1 end) and  
  f3 like  '% '+(case when f1=9 then  'v2 ' else f3 end)+ '% '
------解决方案--------------------应把 and 改为 or 吧