select * from books where classid=1 and (type=0 or 0=0)用OR来实现对输入参数的屏蔽

解决方案 »

  1.   

    type什么类型的?有空值吗?前面一段Sql是程序产生的
    ----
    最好别用生成的
      

  2.   

    type是什么类型的字段?如果是字符型的也可以用 type like '%'
      

  3.   

    如果select * from books where classid=1 and type=是固定的
    那样'('加不进去,'='无法改成别的。基本上是没戏了。还不如自己写,不用生成的。